예제 #1
0
  public void addProjectIcon(Project project) {
    FlowPanel projectPanel = new FlowPanel();

    JsArrayString appStrings = project.getApps();
    String description = "";

    for (int i = 0; i < appStrings.length(); i++) {
      if (i == appStrings.length() - 1) description += appStrings.get(i);
      else description += appStrings.get(i) + ", ";
    }

    final String projectName = project.getName();
    final String appNames = description;

    Image projectImg = new Image(res.projectdefaulticon2().getUrl());
    projectImg.setPixelSize(64, 64);

    projectPanel.add(projectImg);
    projectPanel.add(new Label(projectName));

    final FocusPanel testLabel = new FocusPanel();
    testLabel.add(projectPanel);
    testLabel.setStyleName(style.projectIcon());
    testLabel.addMouseOverHandler(
        new MouseOverHandler() {
          public void onMouseOver(MouseOverEvent event) {
            testLabel.setStyleName(style.projectIconActive());
            desc.show();
            desc.setPopupPosition(
                testLabel.getAbsoluteLeft() + testLabel.getOffsetWidth(),
                testLabel.getAbsoluteTop() - 5);
            desc.setTitle("Applications");
            desc.setText(appNames);
          }
        });
    testLabel.addMouseOutHandler(
        new MouseOutHandler() {
          public void onMouseOut(MouseOutEvent event) {
            testLabel.setStyleName(style.projectIcon());
            desc.hide();
          }
        });
    testLabel.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            testLabel.setStyleName(style.projectIcon());
            eventBus.fireEvent(
                new PanelTransitionEvent(
                    PanelTransitionEvent.TransitionTypes.DASHBOARD, projectName));
          }
        });

    projectIconsFlowPanel.add(testLabel);
    iconMap.put(project.getName(), projectIconsFlowPanel.getWidgetIndex(testLabel));
  }
예제 #2
0
  public BestUnit(AlbumObj albumObjj, int poss) {
    this.albumObj = albumObjj;
    this.pos = poss;

    panel.addStyleName("bestUnit");

    /////// Album Image/////////

    albumImage.addStyleName("albumImageBest");
    albumImage
        .getElement()
        .getStyle()
        .setProperty(
            "background",
            "url(\"/extranewgwt/getphoto?photoid="
                + albumObj.getCoverPicID()
                + "\") no-repeat center");
    panel.add(albumImage);

    /////// Rating/////
    likesStatBlock = new LikesStatBlock(albumObj, true);
    likesStatBlock.addStyleName("likesStatBlockBest");
    panel.add(likesStatBlock);

    /////// Position Label//////
    posLabel = new Label(this.pos + 1 + "");
    posLabel.addStyleName("posLabel");
    posLabel.addStyleName("text12_white_bold");
    panel.add(posLabel);

    /////// Name Label//////
    nameLabel = new Label(albumObj.getAlbname());
    nameLabel.addStyleName("nameLabel");
    nameLabel.addStyleName("text11_White");
    panel.add(nameLabel);

    // gotoAlbum.setText("Best" + albumObj.getAlbname());

    albumImage.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            // History.back();
            GoogleAnalytics.trackEvent("Pinbelle", "BestBlock_Album_Clicked", "default");
            String params =
                "albid=" + albumObj.getAlbid() + "&coverid=" + albumObj.getCoverImgObjID();
            ClientFactory.getPlaceController().goTo(new ModelPlace(params, false, null));
          }
        });

    initWidget(panel);
  }
  @Override
  public void start(
      final WebGLRenderer renderer, final int width, final int height, FocusPanel panel) {
    if (timer != null) {
      timer.cancel();
      timer = null;
    }
    renderer.setClearColorHex(0xcccccc, 1);

    final Map<Integer, Mesh> meshs = new HashMap<Integer, Mesh>();

    final Camera camera = THREE.PerspectiveCamera(35, (double) width / height, .1, 10000);
    camera.getPosition().set(0, 0, 50);
    camera.getRotation().set(0, 0, 0);

    final Scene scene = THREE.Scene();

    final Material material = THREE.MeshLambertMaterial().color(0xff00ff).build();

    final Mesh mesh = THREE.Mesh(THREE.CylinderGeometry(5, 5, 5, 6), material);
    scene.add(mesh);

    final Mesh mesh2 =
        THREE.Mesh(
            THREE.CylinderGeometry(5, 5, 5, 15),
            THREE.MeshLambertMaterial().color(0x00ff00).build());
    mesh2.setPosition(0, 10, 0);
    scene.add(mesh2);

    final Mesh mesh3 =
        THREE.Mesh(
            THREE.CylinderGeometry(5, 1, 5, 15),
            THREE.MeshLambertMaterial().color(0x0000ff).build());
    mesh3.setPosition(0, -10, 0);
    scene.add(mesh3);

    final Mesh mesh4 =
        THREE.Mesh(
            THREE.CylinderGeometry(5, 4.5, 5, 5),
            THREE.MeshLambertMaterial().color(0xffff00).build());
    mesh4.setPosition(-10, 0, 0);
    scene.add(mesh4);

    final Light light = THREE.PointLight(0xffffff);
    light.setPosition(10, 0, 10);
    scene.add(light);

    meshs.put(mesh.getId(), mesh);
    meshs.put(mesh2.getId(), mesh2);
    meshs.put(mesh3.getId(), mesh3);
    meshs.put(mesh4.getId(), mesh4);

    MainWidget.cameraMove.setX(0);
    MainWidget.cameraMove.setY(0);
    MainWidget.cameraMove.setZ(50);

    timer =
        new Timer() {
          public void run() {
            mesh.getRotation().incrementX(0.02);
            mesh.getRotation().incrementY(0.02);

            renderer.render(scene, camera);
            camera.setPosition(
                MainWidget.cameraMove.getX(),
                MainWidget.cameraMove.getY(),
                MainWidget.cameraMove.getZ());
          }
        };
    timer.scheduleRepeating(1000 / 60);

    final Projector projector = THREE.Projector();
    panel.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            JsArray<Intersect> intersects =
                projector.gwtPickIntersects(
                    event.getX(), event.getY(), width, height, camera, scene);
            if (intersects.length() > 0) {}

            for (int i = 0; i < intersects.length(); i++) {
              Intersect sect = intersects.get(i);

              final Mesh target = meshs.get(sect.getObject().getId());
              log(target);

              final int old = target.getMaterial().getColor().getHex();
              target.getMaterial().getColor().setHex(0xeeeeee);
              Timer timer =
                  new Timer() {

                    @Override
                    public void run() {
                      target.getMaterial().getColor().setHex(old);
                    }
                  };
              timer.schedule(1000);
            }
          }
        });
  }