コード例 #1
0
 public void generatePushValue(final GeneratorAdapter generator, final Object value) {
   FontDescriptor descriptor = (FontDescriptor) value;
   if (descriptor.isFixedFont()) {
     if (!descriptor.isFullyDefinedFont())
       throw new IllegalStateException("Unexpected font state");
     generator.newInstance(ourFontType);
     generator.dup();
     generator.push(descriptor.getFontName());
     generator.push(descriptor.getFontStyle());
     generator.push(descriptor.getFontSize());
     generator.invokeConstructor(ourFontType, ourInitMethod);
   } else if (descriptor.getSwingFont() != null) {
     generator.push(descriptor.getSwingFont());
     generator.invokeStatic(ourUIManagerType, ourUIManagerGetFontMethod);
   } else {
     throw new IllegalStateException("Unknown font type");
   }
 }
コード例 #2
0
  public boolean generateCustomSetValue(
      final LwComponent lwComponent,
      final InstrumentationClassFinder.PseudoClass componentClass,
      final LwIntrospectedProperty property,
      final GeneratorAdapter generator,
      final int componentLocal,
      final String formClassName) {
    FontDescriptor descriptor = (FontDescriptor) property.getPropertyValue(lwComponent);
    if (descriptor.isFixedFont() && !descriptor.isFullyDefinedFont()) {
      generator.loadLocal(componentLocal);
      generatePushFont(
          generator, componentLocal, lwComponent, descriptor, property.getReadMethodName());

      Method setFontMethod =
          new Method(property.getWriteMethodName(), Type.VOID_TYPE, new Type[] {ourFontType});
      Type componentType = AsmCodeGenerator.typeFromClassName(lwComponent.getComponentClassName());
      generator.invokeVirtual(componentType, setFontMethod);
      return true;
    }
    return false;
  }