Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.Panel


      listBox_ = new ListBox(isMultipleSelect);
      for (int i = 0; i < options.length; i++)
         listBox_.addItem(options[i], values[i]);
     
      Panel panel = null;
      if (horizontalLayout)
      {
         horizontalPanel_ = new HorizontalPanel();
         Label labelWidget = new Label(label);
         if (listOnLeft)
         {
            horizontalPanel_.add(listBox_);
            horizontalPanel_.add(labelWidget);
         }
         else
         {
            horizontalPanel_.add(labelWidget);
            horizontalPanel_.add(listBox_);
         }
       
         horizontalPanel_.setCellVerticalAlignment(
                                          labelWidget,
                                          HasVerticalAlignment.ALIGN_MIDDLE);
         panel = horizontalPanel_;
      }
      else
      {
         flowPanel_ = new FlowPanel();
         flowPanel_.add(new Label(label, true));
         panel = flowPanel_;
         panel.add(listBox_);
      }

      initWidget(panel);
      addStyleName(ThemeResources.INSTANCE.themeStyles().selectWidget());
   }
View Full Code Here


                        constraints.put( connectionRef,
                                         constraint );
                    }
                } );

                Panel panel = new HorizontalPanel();
                panel.add( new Label( constants.Priority() ) );
                panel.add( priorityTextBox );
                panel.add( new Label( constants.ValueRuleFlow() ) );
                panel.add( constraintTextBox );

                parametersForm.addAttribute( constraint.getName(),
                                             panel );
            }
        }
View Full Code Here

    this.referenceSource = referenceSource;
  }
 
  @Override
  public void initialize() {
    Panel panel = new FlowPanel();
    panel.add(new InlineLabel("Reference: "));
    panel.add(new Anchor(referenceSource, referenceSource));
    add(panel);
    add(getPrimarySurface());
    getPrimarySurface().clear();
  }
View Full Code Here

  private final List<AbstractDemo> demos = new ArrayList<AbstractDemo>();
  private int selectedIndex = 0;
  private final TextArea sourceTextArea = new TextArea();
 
  public void onModuleLoad() {   
    final Panel demoPanel = new FlowPanel();
    demos.add(new AnimationDemo(demoPanel));
    demos.add(new CanvasOnCanvasDemo(demoPanel));
    demos.add(new ColorDemo(demoPanel));
    demos.add(new ClippingDemo(demoPanel));
    demos.add(new DataUrlDemo(demoPanel));
    demos.add(new DrawingPadDemo(demoPanel));
    demos.add(new GradientDemo(demoPanel));
    demos.add(new ParticlesDemo(demoPanel));
    demos.add(new PatternDemo(demoPanel));
    demos.add(new PixelManipulatorDemo(demoPanel));
    demos.add(new ShadowDemo(demoPanel));
    demos.add(new ShapeDemo(demoPanel));
    demos.add(new TetrisDemo(demoPanel));
    demos.add(new TextDemo(demoPanel));
    demos.add(new VideoAudioDemo(demoPanel));
    demos.add(new VideoCanvasDemo(demoPanel));
    demos.add(new PropertyTest(demoPanel));
       
    final ListBox listBox = new ListBox();
    for (AbstractDemo demo : demos) {
      listBox.addItem(demo.getDemoName());
    }
   
    listBox.addChangeHandler(new ChangeHandler() {
      @Override
      public void onChange(ChangeEvent event) {
        demos.get(selectedIndex).cancel();
       
        demoPanel.clear();
        selectedIndex = listBox.getSelectedIndex();
        AbstractDemo selectedDemo = demos.get(selectedIndex);
        selectedDemo.initialize();
        selectedDemo.start();
      }
    });
   
    HorizontalPanel splitPanel = new HorizontalPanel();
    splitPanel.setSize("100%", "100%");
   
    Panel panel = new FlowPanel();
    panel.add(new HTML("This demo is created using "
        + "<a href=\"http://code.google.com/p/gwt-g2d/\">gwt-g2d</a>"
        + " inspired by <a href=\"http://code.google.com/p/gwt-canvas/\">gwt-canvas</a>"));
    panel.add(listBox);
   
    sourceTextArea.setSize("600px", "800px");
    sourceTextArea.setReadOnly(true);
    sourceTextArea.getElement().getStyle().setFloat(Float.RIGHT);
    sourceTextArea.removeStyleName("gwt-TextArea-readonly");
    Button showSourceBtn = new Button("Source");
    showSourceBtn.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        String demoName = demos.get(selectedIndex).getDemoName()
            .replace(" ", "").toLowerCase();
        ResourcePrototype resource = Resources.INSTANCE.getResource(demoName);
        if (resource == null) {
          sourceTextArea.setText("Source codes not included for this demo.\n"
              + "See the trunk for the codes.");
        }
        loadExternalTextResource((ExternalTextResource) resource);
      }
    });
    panel.add(showSourceBtn);
    panel.add(demoPanel);
    splitPanel.add(panel);
    splitPanel.add(sourceTextArea);
   
    RootPanel.get().add(splitPanel);
   
View Full Code Here

    super("Tetris", demoPanel);
  }

  @Override
  public void initialize() {
    Panel panel = new FlowPanel();
    add(panel);
    tetris = new Tetris(1, panel);
    tetris.initialize();
  }
View Full Code Here

        levelOffset++;
        resetButton.click();
      }
    });
   
    Panel nextPiecePanel = createPanel(
        createPanel(createHeaderLabel("Next Piece"), nextPieceSurface),
        createPanel(createHeaderLabel("Lines Cleared"), rowsClearedLabel),
        createPanel(createHeaderLabel("Level"), levelLabel),
        createPanel(resetButton),
        createPanel(previousLevelButton),
        createPanel(nextLevelButton));
    nextPiecePanel.setStyleName("sidePanel");
    nextPiecePanel.setHeight(surface.getHeight() + "px");
    panel.add(nextPiecePanel, DockPanel.LINE_END);
   
    nextPieceSurface.fillBackground(KnownColor.BLACK);
   
    surface.setFocus(true);
View Full Code Here

   *
   * @param widgets the widgets to add to the panel.
   * @return a new panel that contains the given widgets.
   */
  private Panel createPanel(Widget... widgets) {
    Panel panel = new FlowPanel();
    for (Widget w : widgets) {
      panel.add(w);
    }
    return panel;
  }
View Full Code Here

  /** Reveals the log div, and executes a task when done. */
  // The async API for this method is intended to support two things: a cool
  // spew animation, and also the potential to runAsync the whole LogPanel code.
  private static void attachLogPanel() {
    Logs.get().addHandler(domLogger);
    final Panel logHolder = RootPanel.get("logHolder");
    logHolder.setVisible(true);

    // Need one layout and paint cycle after revealing it to start animation.
    // Use high priority to avoid potential starvation by other tasks if a
    // problem is occurring.
    SchedulerInstance.getHighPriorityTimer().scheduleDelayed(new Task() {
      @Override
      public void execute() {
        logHolder.add(domLogger);
        Style waveStyle = Document.get().getElementById(WAVEPANEL_PLACEHOLDER).getStyle();
        Style logStyle = logHolder.getElement().getStyle();
        logStyle.setHeight(250, Unit.PX);
        waveStyle.setBottom(250, Unit.PX);
      }
    }, 50);
  }
View Full Code Here

  private void showErrors() {
    clear();
    BuilderResult errors = result.result;

    Panel err = new SimplePanel();

    PackageBuilderWidget.showBuilderErrors(errors, err, editEvent);
    layout.startSection(constants.BuildErrorsUnableToRunScenarios());

    layout.addRow(err);
View Full Code Here

        return box;
    }

    private Widget listEditor(final ValueChanged changed) {
        Panel panel = new VerticalPanel();
        //nheron
        int i = 0;
        for (final FieldData f : this.field.collectionFieldList) {

            DirtyableHorizontalPane hpanel = new DirtyableHorizontalPane();

            FieldDataConstraintEditor fieldElement = new FieldDataConstraintEditor(f.collectionType, new ValueChanged() {
                public void valueChanged(String newValue) {
                    f.value = newValue ;
                    calculateValueFromList();
                    makeDirty();
                }
            }, f, givenFact, sce, scenario, executionTrace);
            hpanel.add(fieldElement);
            final int index = i;
            Image del = new ImageButton("images/delete_item_small.gif", Format.format(constants.AElementToDelInCollectionList(), "tt"), new ClickListener() {
                public void onClick(Widget w) {
                    field.collectionFieldList.remove(index);
                    calculateValueFromList();
                    refreshEditor();
                }
            });

            hpanel.add(del);

            Image addPattern = new ImageButton("images/new_item_below.png");
            addPattern.setTitle(constants.AddElementBelow());


            addPattern.addClickListener(new ClickListener(){
                public void onClick(Widget sender) {
                   FieldData newFieldData = new FieldData();
                   newFieldData.name = field.name;
                   newFieldData.collectionType = field.collectionType;
                   field.collectionFieldList.add(index+1,newFieldData);
                   calculateValueFromList();
                   refreshEditor();
                }
            });
            hpanel.add(addPattern);
            Image moveDown = new ImageButton("images/shuffle_down.gif");
            moveDown.setTitle(constants.MoveDownListMove());
            moveDown.addClickListener(new ClickListener(){
                public void onClick(Widget sender) {
                   if (index <field.collectionFieldList.size()-1){
                          FieldData onMyLine =field.collectionFieldList.get(index);
                          FieldData onDown =field.collectionFieldList.get(index+1);
                          field.collectionFieldList.set(index+1,onMyLine);
                          field.collectionFieldList.set(index,onDown);
                          calculateValueFromList();
                          refreshEditor();
                   }
                }
            });
            hpanel.add(moveDown);

            Image moveUp = new ImageButton("images/shuffle_up.gif");
            moveUp.setTitle(constants.MoveUpList());
            moveUp.addClickListener(new ClickListener(){
                public void onClick(Widget sender) {
                   if (index >0){
                          FieldData oneUp =field.collectionFieldList.get(index-1);
                          FieldData onMyLine =field.collectionFieldList.get(index);
                          field.collectionFieldList.set(index,oneUp);
                          field.collectionFieldList.set(index-1,onMyLine);
                          calculateValueFromList();
                          refreshEditor();
                   }
                }
            });
            hpanel.add(moveUp);
            panel.add(hpanel);
             i++;
        }
   

        if (this.field.collectionFieldList.size()==0){
            Image add = new ImageButton("images/new_item.gif", Format.format(constants.AElementToAddInCollectionList(), "tt"), new ClickListener() {
                public void onClick(Widget w) {
                    FieldData newFieldData = new FieldData();
                    newFieldData.name = field.name;
                    newFieldData.collectionType = field.collectionType;
                    field.collectionFieldList.add(newFieldData);
                    calculateValueFromList();
                    refreshEditor();
                }
            });
            panel.add(add);
        }
        return panel;
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.Panel

Copyright © 2018 www.massapicom. 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.