Examples of WidgetAdapter


Examples of org.dyno.visual.swing.plugin.spi.WidgetAdapter

    if (adapter instanceof CompositeAdapter) {
      CompositeAdapter compositeAdapter = (CompositeAdapter) adapter;
      int count = compositeAdapter.getChildCount();
      for (int i = 0; i < count; i++) {
        Component child = compositeAdapter.getChild(i);
        WidgetAdapter childAdapter = WidgetAdapter.getWidgetAdapter(child);
        parsePropertyValue(lnfClassname, cunit, childAdapter);
      }
    }
  }
View Full Code Here

Examples of org.dyno.visual.swing.plugin.spi.WidgetAdapter

      ParserPlugin.getLogger().error(e);
      throw new ParserException(e);
    }

    JComponent fieldComponent = (JComponent) fieldValue;
    WidgetAdapter adapter = ExtensionRegistry.createWidgetAdapter(fieldComponent, true);
    if (adapter.getWidget() != fieldComponent && fieldComponent instanceof JPopupMenu && adapter.getWidget() instanceof JPopupMenu) {
      JComponent jcomp = findPopupInvoker((JPopupMenu) fieldComponent, bean);
      if (jcomp != null) {
        jcomp.setComponentPopupMenu((JPopupMenu) adapter.getWidget());
      }
    }
    adapter.setName(fieldName);
    adapter.setLastName(fieldName);
    int flags = field.getModifiers();
    setAdapterFieldAccess(adapter, flags);

    String getName = NamespaceUtil.getGetMethodName(fieldName);
    Method getMethod = null;
    try {
      getMethod = clazz.getDeclaredMethod(getName);
    } catch (NoSuchMethodException nsme) {
      getName = NamespaceUtil.getGetMethodName(cunit, fieldName);
      if (getName == null)
        throw new ParserException("Method " + NamespaceUtil.getGetMethodName(fieldName) + "() is not found!\n" + "Please define it to initialize " + fieldName);
      try {
        getMethod = clazz.getDeclaredMethod(getName);
        WidgetAdapter ba = WidgetAdapter.getWidgetAdapter(fieldComponent);
        ba.setProperty("getMethodName", getName);
      } catch (NoSuchMethodException e) {
        throw new ParserException("Method " + getName + "() is not found!\n" + "Please define it to initialize " + fieldName);
      }
    }
View Full Code Here

Examples of org.dyno.visual.swing.plugin.spi.WidgetAdapter

    if (root instanceof CompositeAdapter) {
      CompositeAdapter container = (CompositeAdapter) root;
      int count = container.getChildCount();
      for (int i = 0; i < count; i++) {
        Component child = container.getChild(i);
        WidgetAdapter childAdapter = WidgetAdapter.getWidgetAdapter(child);
        rename(type, childAdapter);
      }
    }
  }
View Full Code Here

Examples of org.dyno.visual.swing.plugin.spi.WidgetAdapter

    } else
      return null;
  }

  private void changeComponentDirtyFlag() {
    WidgetAdapter adapter = WidgetAdapter.getWidgetAdapter(component);
    if(adapter!=null){
      adapter.setDirty(true);
      adapter.repaintDesigner();
    }     
  }
View Full Code Here

Examples of org.dyno.visual.swing.plugin.spi.WidgetAdapter

  @Override
  protected void genAddCode(ImportRewrite imports, StringBuilder builder) {
    CompositeAdapter jspa = (CompositeAdapter) adaptable;
    if (jspa.getChildCount() > 0) {
      Component child = jspa.getChild(0);
      WidgetAdapter childAdapter = WidgetAdapter.getWidgetAdapter(child);
      IParser childParser = (IParser) childAdapter.getAdapter(IParser.class);
      String getMethodName = childParser.getCreationMethodName();
      if (!adaptable.isRoot())
        builder.append(jspa.getID() + ".");
      builder.append("setViewportView(" + getMethodName + "());\n");
    }
View Full Code Here

Examples of org.dyno.visual.swing.plugin.spi.WidgetAdapter

      prefix = fieldName + ".";
    if (oritentation == JSplitPane.HORIZONTAL_SPLIT) {
      Component left = jsp.getLeftComponent();
      if (left != null) {
        JComponent leftComponent = (JComponent) left;
        WidgetAdapter leftAdapter = WidgetAdapter
            .getWidgetAdapter(leftComponent);
        if (leftAdapter != null) {
          IParser leftParser = (IParser) leftAdapter
              .getAdapter(IParser.class);
          String leftGetName = leftParser.getCreationMethodName();
          builder.append(prefix + "setLeftComponent(" + leftGetName
              + "());\n");
        }
      }
      Component right = jsp.getRightComponent();
      if (right != null) {
        JComponent rightComponent = (JComponent) right;
        WidgetAdapter rightAdapter = WidgetAdapter
            .getWidgetAdapter(rightComponent);
        if (rightAdapter != null) {
          IParser rightParser = (IParser) rightAdapter
              .getAdapter(IParser.class);
          String rightGetName = rightParser.getCreationMethodName();
          builder.append(prefix + "setRightComponent(" + rightGetName
              + "());\n");
        }
      }
    } else {
      Component top = jsp.getTopComponent();
      if (top != null) {
        JComponent topComponent = (JComponent) top;
        WidgetAdapter topAdapter = WidgetAdapter
            .getWidgetAdapter(topComponent);
        if (topAdapter != null) {
          IParser topParser = (IParser) topAdapter
              .getAdapter(IParser.class);
          String topGetName = topParser.getCreationMethodName();
          builder.append(prefix + "setTopComponent(" + topGetName
              + "());\n");
        }
      }
      Component bottom = jsp.getBottomComponent();
      if (bottom != null) {
        JComponent bottomComponent = (JComponent) bottom;
        WidgetAdapter bottomAdapter = WidgetAdapter
            .getWidgetAdapter(bottomComponent);
        if (bottomAdapter != null) {
          IParser bottomParser = (IParser) bottomAdapter
              .getAdapter(IParser.class);
          String bottomGetName = bottomParser.getCreationMethodName();
          builder.append(prefix + "setBottomComponent("
              + bottomGetName + "());\n");
        }
View Full Code Here

Examples of org.dyno.visual.swing.plugin.spi.WidgetAdapter

    case BoxLayout.PAGE_AXIS:
      strAxis = "PAGE_AXIS";
      break;
    }
    strAxis = name+"."+strAxis;
    WidgetAdapter adapter = WidgetAdapter.getWidgetAdapter(layoutAdapter.getContainer())
    String conName=adapter.isRoot()?"this":adapter.getID();
    return "new "+name+"("+conName+", "+strAxis+")";
  }
View Full Code Here

Examples of org.dyno.visual.swing.plugin.spi.WidgetAdapter

@SuppressWarnings("unchecked")
public class WidgetRemovalListener implements IWidgetListener{
 
  public void widgetAdded(WidgetEvent event) {
    WidgetAdapter adapter = event.getParent().getRootAdapter();
    List<String> names = (List<String>) adapter.getProperty("removed.components");
    if (names == null) {
      names = new ArrayList<String>();
      adapter.setProperty("removed.components", names);
    }
    WidgetAdapter targetAdapter = event.getTarget();
    String ID = targetAdapter.getID();
    if (names.contains(ID))
      names.remove(ID);
  }
View Full Code Here

Examples of org.dyno.visual.swing.plugin.spi.WidgetAdapter

  public void widgetMoved(WidgetEvent event) {
  }

 
  public void widgetRemoved(WidgetEvent event) {
    WidgetAdapter adapter = event.getParent().getRootAdapter();
    List<String> names = (List<String>) adapter.getProperty("removed.components");
    if (names == null) {
      names = new ArrayList<String>();
      adapter.setProperty("removed.components", names);
    }
    WidgetAdapter targetAdapter = event.getTarget();
    removeNameRecursively(targetAdapter, names);
  }
View Full Code Here

Examples of org.dyno.visual.swing.plugin.spi.WidgetAdapter

    if(targetComponent instanceof JComponent){
      JComponent target = (JComponent) targetComponent;
      if(JavaUtil.getComponentPopupMenu(target)!=null){
        JPopupMenu jpm = JavaUtil.getComponentPopupMenu(target);
        if(jpm!=null&&WidgetAdapter.getWidgetAdapter(jpm)!=null){
          WidgetAdapter jpmAdapter = WidgetAdapter.getWidgetAdapter(jpm);
          removeNameRecursively(jpmAdapter, names);
        }
      }
    }
    if(targetAdapter instanceof CompositeAdapter){
      CompositeAdapter composite = (CompositeAdapter)targetAdapter;
      int count = composite.getChildCount();
      for(int i=0;i<count;i++){
        Component child = composite.getChild(i);
        WidgetAdapter childAdapter = WidgetAdapter.getWidgetAdapter(child);
        removeNameRecursively(childAdapter, names);
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.