private static void processElement(
     Object element,
     ClassLoader classLoader,
     Method putMethod,
     Object context,
     Method putByNameMethod)
     throws ClassNotFoundException, InstantiationException, InvocationTargetException,
         ConfigurationException, IllegalAccessException, IllegalArgumentException {
   if (element instanceof Component) {
     Component c = (Component) element;
     Class compClass = Class.forName(c.getClazz(), true, classLoader);
     String name = c.getName();
     Object instance = compClass.newInstance();
     for (Property p : c.getProperty()) {
       setPropertyOnComponent(instance, p.getName(), p.getValue());
       log.log(
           Level.FINER,
           MessageNames.SET_PROPERTY_ON_COMPONENT,
           new Object[] {p.getName(), c.getClazz(), c.getName(), p.getValue()});
     }
     if (name == null || name.trim().length() == 0) {
       putMethod.invoke(context, instance);
     } else {
       putByNameMethod.invoke(context, name, instance);
     }
   } else if (element instanceof Property) {
     Property p = (Property) element;
     putByNameMethod.invoke(context, p.getName(), p.getValue());
   } else if (element instanceof DiscoveryContextType) {
     /*
     Just drop the element into the context under the appropriate name.
     */
     DiscoveryContextType dct = (DiscoveryContextType) element;
     if (dct.getName() == null) {
       putByNameMethod.invoke(context, Strings.DEFAULT_DISCOVERY_CONTEXT, dct);
     } else {
       putByNameMethod.invoke(context, dct.getName(), dct);
     }
   } else {
     throw new ConfigurationException(
         MessageNames.UNSUPPORTED_ELEMENT, element.getClass().getName());
   }
 }
Exemplo n.º 2
0
 void canvasFocusLost(FocusEvent e) {
   if (isXEmbedActive() && !e.isTemporary()) {
     xembedLog.fine("Forwarding FOCUS_LOST");
     int num = 0;
     if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.xembed.testing"))) {
       Component opp = e.getOppositeComponent();
       try {
         num = Integer.parseInt(opp.getName());
       } catch (NumberFormatException nfe) {
       }
     }
     xembed.sendMessage(xembed.handle, XEMBED_FOCUS_OUT, num, 0, 0);
   }
 }
Exemplo n.º 3
0
 /**
  * Returns the value to initialize the opacity property of the Component to. A Style should NOT
  * assume the opacity will remain this value, the developer may reset it or override it.
  *
  * @param context SynthContext identifying requestor
  * @return opaque Whether or not the JComponent is opaque.
  */
 @Override
 public boolean isOpaque(SynthContext context) {
   Region region = context.getRegion();
   if (region == Region.COMBO_BOX
       || region == Region.DESKTOP_PANE
       || region == Region.DESKTOP_ICON
       || region == Region.EDITOR_PANE
       || region == Region.FORMATTED_TEXT_FIELD
       || region == Region.INTERNAL_FRAME
       || region == Region.LIST
       || region == Region.MENU_BAR
       || region == Region.PANEL
       || region == Region.PASSWORD_FIELD
       || region == Region.POPUP_MENU
       || region == Region.PROGRESS_BAR
       || region == Region.ROOT_PANE
       || region == Region.SCROLL_PANE
       || region == Region.SPINNER
       || region == Region.SPLIT_PANE_DIVIDER
       || region == Region.TABLE
       || region == Region.TEXT_AREA
       || region == Region.TEXT_FIELD
       || region == Region.TEXT_PANE
       || region == Region.TOOL_BAR_DRAG_WINDOW
       || region == Region.TOOL_TIP
       || region == Region.TREE
       || region == Region.VIEWPORT) {
     return true;
   }
   Component c = context.getComponent();
   String name = c.getName();
   if (name == "ComboBox.renderer" || name == "ComboBox.listRenderer") {
     return true;
   }
   return false;
 }