/* * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.tests; import java.io.File; import java.net.URL; import java.util.ArrayList; import java.util.Iterator; import com.vaadin.data.Container; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.util.IndexedContainer; import com.vaadin.server.LegacyApplication; import com.vaadin.server.ThemeResource; import com.vaadin.shared.ui.combobox.FilteringMode; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.AbstractSelect; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.ComboBox; import com.vaadin.ui.Component; import com.vaadin.ui.ComponentContainer; import com.vaadin.ui.Embedded; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.LegacyWindow; import com.vaadin.ui.Panel; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; public class TestSizeableIncomponents extends LegacyApplication { private IndexedContainer cont; private ComboBox select; private Button prev; private Button next; private VerticalLayout testPanelLayout; private Panel testPanel; @Override public void init() { initComponentList(); LegacyWindow w = new LegacyWindow(); setMainWindow(w); setTheme("tests-components"); final VerticalLayout main = new VerticalLayout(); w.setContent(main); select = new ComboBox(); select.setImmediate(true); select.setFilteringMode(FilteringMode.CONTAINS); select.setWidth("400px"); prev = new Button("<<-|"); prev.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Object cur = select.getValue(); Testable prev = (Testable) cont.prevItemId(cur); if (prev == null) { getMainWindow().showNotification("No more test cases"); } else { getMainWindow().showNotification( "Selected test:" + prev.getTestableName()); select.setValue(prev); select.markAsDirty(); } } }); next = new Button("|->>"); next.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Object cur = select.getValue(); Testable next = (Testable) cont.nextItemId(cur); if (next == null) { getMainWindow().showNotification("No more test cases"); } else { getMainWindow().showNotification( "Selected test:" + next.getTestableName()); select.setValue(next); select.markAsDirty(); } } }); HorizontalLayout controllers = new HorizontalLayout(); controllers.addComponent(prev); controllers.addComponent(select); controllers.addComponent(next); main.addComponent(controllers); select.setContainerDataSource(cont); select.addListener(new ComboBox.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Testable t = (Testable) select.getValue(); if (t != null) { testPanelLayout.removeAllComponents(); try { Component c = t.getComponent(); if (c != null) { testPanelLayout.addComponent(c); } } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }); testPanelLayout = new VerticalLayout(); testPanel = new Panel(testPanelLayout); testPanel.setSizeFull(); testPanel.setStyleName("testable"); main.addComponent(testPanel); main.setExpandRatio(testPanel, 1); } private void initComponentList() { cont = new IndexedContainer(); ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL dir = cl.getResource("com/vaadin/ui"); String[] list2 = (new File(dir.getFile())).list(); for (int i = 0; i < list2.length; i++) { String f = list2[i]; if (f.endsWith(".class") && (f.indexOf("CustomComponent") == -1) && (f.indexOf("Window") == -1)) { f = f.replaceAll(".class", ""); String className = "com.vaadin.ui." + f; Class c; try { c = Class.forName(className); Object o = c.newInstance(); if (o instanceof Component) { Testable t = new Testable(c); cont.addItem(t); t = new Testable(c); t.addConfiguration(new Configuration("100px*100px") { @Override void configure(Component c) { c.setWidth("60px"); c.setHeight("60px"); } }); t = new Testable(c); t.addConfiguration(new Configuration("Width 50em") { @Override void configure(Component c) { c.setWidth("50em"); } }); cont.addItem(t); t = new Testable(c); t.addConfiguration(new Configuration("Height 7cm") { @Override void configure(Component c) { c.setHeight("7cm"); } }); cont.addItem(t); t = new Testable(c) { @Override public Component getComponent() throws InstantiationException, IllegalAccessException { Component c = super.getComponent(); VerticalLayout pl = new VerticalLayout(); pl.setMargin(true); Panel p = new Panel( "Wrapper panel (400px*400px)", pl); p.setContent(new VerticalLayout()); p.setWidth("400px"); p.setHeight("400px"); pl.addComponent(c); p.addStyleName("testablew"); p.addStyleName("testable"); return p; } }; t.addConfiguration(new Configuration("100%*100%") { @Override void configure(Component c) { c.setSizeFull(); } }); cont.addItem(t); } } catch (ClassNotFoundException e) { // TODO Auto-generated catch block // e.printStackTrace(); } catch (InstantiationException e) { // TODO Auto-generated catch block // e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block // e.printStackTrace(); } } } } class Testable { private Class classToTest; private ArrayList configurations = new ArrayList(); Testable(Class c) {
package org.aspectj.apache.bcel.generic;

/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2001 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Apache" and "Apache Software Foundation" and
 *    "Apache BCEL" must not be used to endorse or promote products
 *    derived from this software without prior written permission. For
 *    written permission, please contact apache@apache.org.
 *
 * 5. Products derived from this software may not be called "Apache",
 *    "Apache BCEL", nor may "Apache" appear in their name, without
 *    prior written permission of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 */

/** 
 * LALOAD - Load long from array
 * <PRE>Stack: ..., arrayref, index -&gt; ..., value1, value2</PRE>
 *
 * @version $Id: LALOAD.java,v 1.2 2004/11/19 16:45:18 aclement Exp $
 * @author  <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
 */
public class LALOAD extends ArrayInstruction implements StackProducer {
  /** Load long from array
   */
  public LALOAD() {
    super(org.aspectj.apache.bcel.Constants.LALOAD);
  }


  /**
   * Call corresponding visitor method(s). The order is:
   * Call visitor methods of implemented interfaces first, then
   * call methods according to the class hierarchy in descending order,
   * i.e., the most specific visitXXX() call comes last.
   *
   * @param v Visitor object
   */
  public void accept(Visitor v) {
    v.visitStackProducer(this);
    v.visitExceptionThrower(this);
    v.visitTypedInstruction(this);
    v.visitArrayInstruction(this);
    v.visitLALOAD(this);
  }
}