Examples of Label


Examples of org.apache.lenya.cms.site.Label

        TreeSiteManager manager = (TreeSiteManager) publication.getSiteManager(map);
        SiteTree destinationTree = manager.getTree(destinationArea);
        SiteTreeNode destinationNode = destinationTree.getNode(_destinationDocumentId);
        assertNotNull(destinationNode);
        Label destinationLabel = destinationNode.getLabel(_destinationLanguage);
        assertNotNull(destinationLabel);

        SiteTreeNode sourceNode = destinationTree.getNode(_sourceDocumentId);
        Label sourceLabel = sourceNode.getLabel(_sourceLanguage);

        assertTrue(destinationLabel.getLabel().equals(sourceLabel.getLabel()));

    }
View Full Code Here

Examples of org.apache.openejb.asm.Label

        mv.visitCode();

        /* if (deleted) return; */
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, implClassName, "deleted", "Z");
        Label notDeleted = new Label();
        mv.visitJumpInsn(IFEQ, notDeleted);
        mv.visitInsn(RETURN);
        mv.visitLabel(notDeleted);

        // deleted = true;
View Full Code Here

Examples of org.apache.openjpa.persistence.merge.model.Label

        EntityManager em = emf.createEntityManager();

        try {
            // Create simple bi-di graph
          ShipPackage p = new ShipPackage();
            Label l = new Label(p);
            p.setLabel(l);
           
            // Persist
            em.getTransaction().begin();
            em.persist(l);
            em.getTransaction().commit();

            // Detach
            em.clear();
            assertFalse(em.contains(l));
            assertFalse(em.contains(p));
            assertFalse(em.contains(l.getPackage()));
            assertFalse(em.contains(p.getLabel()));
           
            em.getTransaction().begin();
            Label mergedLabel = em.merge(l);

            assertFalse(mergedLabel == l);
            assertFalse(p == mergedLabel.getPackage());
            // Assert that the bi-directional relationship points to the
            // newly merged entity
            assertTrue(mergedLabel == mergedLabel.getPackage().getLabel());
            assertFalse(l == mergedLabel.getPackage().getLabel());
            em.remove(mergedLabel);
            em.getTransaction().commit();
        } finally {
            if (em != null) {
                if (em.getTransaction().isActive())
View Full Code Here

Examples of org.apache.pivot.wtk.Label

        return (int)Math.ceil(preferredHeight);
    }

    @Override
    public Dimensions getPreferredSize() {
        Label label = (Label)getComponent();
        String text = label.getText();

        FontRenderContext fontRenderContext = Platform.getFontRenderContext();

        LineMetrics lm = font.getLineMetrics("", fontRenderContext);
        int lineHeight = (int)Math.ceil(lm.getHeight());
View Full Code Here

Examples of org.apache.struts2.components.Label

    public String getBeanName() {
        return "label";
    }

    protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
        return new Label(stack, req, res);
    }
View Full Code Here

Examples of org.apache.tapestry5.internal.plastic.asm.Label

        check();

        assert condition != null;
        assert callback != null;

        Label ifFalseLabel = new Label();
        Label endIfLabel = new Label();

        v.visitJumpInsn(conditionToOpcode.get(condition), ifFalseLabel);

        new InstructionBuilderCallback()
        {
View Full Code Here

Examples of org.apache.wicket.markup.html.basic.Label

      }
      else
      {
         label += ":";
      }
      Label labelComponent = new Label("label", label);
      add(labelComponent);
      feedbackPanel = new FeedbackPanel("message", new ContainerFeedbackMessageFilter(this));
      add(component, model, modelClass, propertyExpression);
      add(feedbackPanel);
   }
View Full Code Here

Examples of org.apache.wicket.ng.markup.html.Label

  public TestPage4(PageParametersNg parameters)
  {
    super(parameters);

    add(new Label("label", parameters.getNamedParameter("color").toString("empty")));
  }
View Full Code Here

Examples of org.apache.xbean.asm.Label

    }
    MethodVisitor mv = cw.visitMethod(modifier, method.getName(), getMethodSignatureAsString(returnType, parameterTypes), null, null);
    mv.visitCode();

    // push try/catch block, to catch declared exceptions, and to catch java.lang.Throwable
    Label l0 = new Label();
    Label l1 = new Label();
    Label l2 = new Label();
    Label l3 = new Label();
   
    if (exceptionTypes.length > 0) {
      mv.visitTryCatchBlock(l0, l1, l2, "java/lang/reflect/InvocationTargetException");
    }
   
//    mv.visitTryCatchBlock(l0, l1, l3, "java/lang/Throwable");
   
    // push try code
    mv.visitLabel(l0);
    String clsToOverride = method.getDeclaringClass().getName().replaceAll("\\.", "/");
    mv.visitLdcInsn(Type.getType("L" + clsToOverride + ";"));
   
    // the following code generates the bytecode for this line of Java:
    // Method method = <proxy>.class.getMethod("add", new Class[] { <array of function argument classes> });

    // get the method name to invoke, and push to stack
    mv.visitLdcInsn(method.getName());
   
    // create the Class[]
    createArrayDefinition(mv, parameterTypes.length, Class.class);
   
    int length = 1;
   
    // push parameters into array
    for (int i = 0; i < parameterTypes.length; i++) {
      // keep copy of array on stack
      mv.visitInsn(DUP);
     
      Class<?> parameterType = parameterTypes[i];
     
      // push number onto stack
      pushIntOntoStack(mv, i);

      if (parameterType.isPrimitive()) {
        String wrapperType = getWrapperType(parameterType);
        mv.visitFieldInsn(GETSTATIC, wrapperType, "TYPE", "Ljava/lang/Class;");
      } else {
        mv.visitLdcInsn(Type.getType(getAsmTypeAsString(parameterType, true)));
      }
     
      mv.visitInsn(AASTORE);
     
      if (Long.TYPE.equals(parameterType) || Double.TYPE.equals(parameterType)) {
        length += 2;
      } else {
        length++;
      }
    }
   
    // invoke getMethod() with the method name and the array of types   
    mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Class", "getDeclaredMethod", "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;");
 
    // store the returned method for later
    mv.visitVarInsn(ASTORE, length);
   
    // the following code generates bytecode equivalent to:
    // return ((<returntype>) invocationHandler.invoke(this, method, new Object[] { <function arguments }))[.<primitive>Value()];
   
    Label l4 = new Label();
    mv.visitLabel(l4);
    mv.visitVarInsn(ALOAD, 0);
   
    // get the invocationHandler field from this class
    mv.visitFieldInsn(GETFIELD, proxyName, handlerName, "Ljava/lang/reflect/InvocationHandler;");
   
    // we want to pass "this" in as the first parameter
    mv.visitVarInsn(ALOAD, 0);
   
    // and the method we fetched earlier
    mv.visitVarInsn(ALOAD, length);
   
    // need to construct the array of objects passed in

    // create the Object[]
    createArrayDefinition(mv, parameterTypes.length, Object.class);

    int index = 1;
    // push parameters into array
    for (int i = 0; i < parameterTypes.length; i++) {
      // keep copy of array on stack
      mv.visitInsn(DUP);
     
      Class<?> parameterType = parameterTypes[i];
     
      // push number onto stack
      pushIntOntoStack(mv, i);

      if (parameterType.isPrimitive()) {
        String wrapperType = getWrapperType(parameterType);
        mv.visitVarInsn(getVarInsn(parameterType), index);
       
        mv.visitMethodInsn(INVOKESTATIC, wrapperType, "valueOf", "(" + getPrimitiveLetter(parameterType) + ")L" + wrapperType + ";");
        mv.visitInsn(AASTORE);
       
        if (Long.TYPE.equals(parameterType) || Double.TYPE.equals(parameterType)) {
          index += 2;
        } else {
          index++;
        }
      } else {
        mv.visitVarInsn(ALOAD, index);
        mv.visitInsn(AASTORE);
        index++;
      }
    }

    // invoke the invocationHandler
    mv.visitMethodInsn(INVOKEINTERFACE, "java/lang/reflect/InvocationHandler", "invoke", "(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;");
   
    // cast the result
    mv.visitTypeInsn(CHECKCAST, getCastType(returnType));
   
    if (returnType.isPrimitive() && (!Void.TYPE.equals(returnType))) {
      // get the primitive value   
      mv.visitMethodInsn(INVOKEVIRTUAL, getWrapperType(returnType), getPrimitiveMethod(returnType), "()" + getPrimitiveLetter(returnType));
    }
   
    // push return
    mv.visitLabel(l1);
    if (! Void.TYPE.equals(returnType)) {
      mv.visitInsn(getReturnInsn(returnType));
    } else {
      mv.visitInsn(POP);
      mv.visitInsn(RETURN);
    }

    // catch InvocationTargetException
    if (exceptionTypes.length > 0) {
      mv.visitLabel(l2);
      mv.visitVarInsn(ASTORE, length);
      Label l5 = new Label();
      mv.visitLabel(l5);
 
      for (int i = 0; i < exceptionTypes.length; i++) {
        Class<?> exceptionType = exceptionTypes[i];
       
        mv.visitLdcInsn(Type.getType("L" + exceptionType.getCanonicalName().replaceAll("\\.", "/") + ";"));
        mv.visitVarInsn(ALOAD, length);
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/reflect/InvocationTargetException", "getCause", "()Ljava/lang/Throwable;");
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "getClass", "()Ljava/lang/Class;");
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "equals", "(Ljava/lang/Object;)Z");
        Label l6 = new Label();
        mv.visitJumpInsn(IFEQ, l6);
        Label l7 = new Label();
        mv.visitLabel(l7);
        mv.visitVarInsn(ALOAD, length);
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/reflect/InvocationTargetException", "getCause", "()Ljava/lang/Throwable;");
        mv.visitTypeInsn(CHECKCAST, exceptionType.getCanonicalName().replaceAll("\\.", "/"));
        mv.visitInsn(ATHROW);
View Full Code Here

Examples of org.apache.xbean.asm4.Label

        MethodVisitor mv = cw.visitMethod(modifier, method.getName(), Type.getMethodDescriptor(method), null, null);
        mv.visitCode();

        // push try/catch block, to catch declared exceptions, and to catch java.lang.Throwable
        final Label l0 = new Label();
        final Label l1 = new Label();
        final Label l2 = new Label();

        if (exceptionTypes.length > 0)
        {
            mv.visitTryCatchBlock(l0, l1, l2, "java/lang/reflect/InvocationTargetException");
        }

        // push try code
        mv.visitLabel(l0);
        final String classNameToOverride = method.getDeclaringClass().getName().replace('.', '/');
        mv.visitLdcInsn(Type.getType("L" + classNameToOverride + ";"));

        // the following code generates the bytecode for this line of Java:
        // Method method = <proxy>.class.getMethod("add", new Class[] { <array of function argument classes> });

        // get the method name to invoke, and push to stack
        mv.visitLdcInsn(method.getName());

        // create the Class[]
        createArrayDefinition(mv, parameterTypes.length, Class.class);

        int length = 1;

        // push parameters into array
        for (int i = 0; i < parameterTypes.length; i++)
        {
            // keep copy of array on stack
            mv.visitInsn(Opcodes.DUP);

            final Class<?> parameterType = parameterTypes[i];

            // push number onto stack
            pushIntOntoStack(mv, i);

            if (parameterType.isPrimitive())
            {
                String wrapperType = getWrapperType(parameterType);
                mv.visitFieldInsn(Opcodes.GETSTATIC, wrapperType, "TYPE", "Ljava/lang/Class;");
            }
            else
            {
                mv.visitLdcInsn(Type.getType(parameterType));
            }

            mv.visitInsn(Opcodes.AASTORE);

            if (Long.TYPE.equals(parameterType) || Double.TYPE.equals(parameterType))
            {
                length += 2;
            }
            else
            {
                length++;
            }
        }

        // the following code generates bytecode equivalent to:
        // return ((<returntype>) invocationHandler.invoke(this, {methodIndex}, new Object[] { <function arguments }))[.<primitive>Value()];

        final Label l4 = new Label();
        mv.visitLabel(l4);

        mv.visitVarInsn(Opcodes.ALOAD, 0);

        // get the invocationHandler field from this class
        mv.visitFieldInsn(Opcodes.GETFIELD, proxyClassFileName, FIELD_INTERCEPTOR_HANDLER, Type.getDescriptor(InterceptorHandler.class));

        // add the Method from the static array as first parameter
        mv.visitFieldInsn(Opcodes.GETSTATIC, proxyClassFileName, FIELD_INTERCEPTED_METHODS, Type.getDescriptor(Method[].class));

        // push the methodIndex of the current method
        mv.visitIntInsn(Opcodes.BIPUSH, methodIndex);

        // and now load the Method from the array
        mv.visitInsn(Opcodes.AALOAD);


        // prepare the parameter array as Object[] and store it on the stack
        pushMethodParameterArray(mv, parameterTypes);


        // invoke the invocationHandler
        mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(InterceptorHandler.class), "invoke",
                "(Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;");

        // cast the result
        mv.visitTypeInsn(Opcodes.CHECKCAST, getCastType(returnType));

        if (returnType.isPrimitive() && (!Void.TYPE.equals(returnType)))
        {
            // get the primitive value
            mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, getWrapperType(returnType), getPrimitiveMethod(returnType),
                    "()" + Type.getDescriptor(returnType));
        }

        // push return
        mv.visitLabel(l1);
        if (!Void.TYPE.equals(returnType))
        {
            mv.visitInsn(getReturnInsn(returnType));
        }
        else
        {
            mv.visitInsn(Opcodes.POP);
            mv.visitInsn(Opcodes.RETURN);
        }

        // catch InvocationTargetException
        if (exceptionTypes.length > 0)
        {
            mv.visitLabel(l2);
            mv.visitVarInsn(Opcodes.ASTORE, length);

            final Label l5 = new Label();
            mv.visitLabel(l5);

            for (int i = 0; i < exceptionTypes.length; i++)
            {
                final Class<?> exceptionType = exceptionTypes[i];

                mv.visitLdcInsn(Type.getType("L" + exceptionType.getCanonicalName().replace('.', '/') + ";"));
                mv.visitVarInsn(Opcodes.ALOAD, length);
                mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/reflect/InvocationTargetException", "getCause",
                        "()Ljava/lang/Throwable;");
                mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Object", "getClass", "()Ljava/lang/Class;");
                mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Object", "equals", "(Ljava/lang/Object;)Z");

                final Label l6 = new Label();
                mv.visitJumpInsn(Opcodes.IFEQ, l6);

                final Label l7 = new Label();
                mv.visitLabel(l7);

                mv.visitVarInsn(Opcodes.ALOAD, length);
                mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/reflect/InvocationTargetException", "getCause",
                        "()Ljava/lang/Throwable;");
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.