/**
   * Page widgets.
   *
   * @param cellTree the cell tree
   */
  public void createPageView(CellTree cellTree) {
    this.cellTree = cellTree;
    mainPanel.setStyleName("div-wrapper"); // main div

    SimplePanel leftPanel = new SimplePanel();
    leftPanel.getElement().setId("leftPanel_SimplePanel");
    leftPanel.setStyleName("div-first bottomPadding10px"); // left side div which will  have tree

    SimplePanel rightPanel = new SimplePanel();
    rightPanel.getElement().setId("rightPanel_SimplePanel");
    rightPanel.setStyleName("div-second"); // right div having tree creation inputs.

    VerticalPanel treePanel = new VerticalPanel();
    treePanel.getElement().setId("treePanel_VerticalPanel");
    HorizontalPanel expandCollapse = new HorizontalPanel();
    expandCollapse.getElement().setId("expandCollapse_HorizontalPanel");
    expandCollapse.setStyleName("leftAndTopPadding");
    expandCollapse.setSize("100px", "20px");
    buttonExpand.setStylePrimaryName("expandAllButton");
    buttonCollapse.setStylePrimaryName("collapseAllButton");
    buttonExpand.setTitle("Expand All (Shift +)");
    buttonCollapse.setTitle("Collapse All (Shift -)");
    expandCollapse.add(buttonExpand);
    expandCollapse.add(buttonCollapse);
    buttonExpand.setFocus(true);
    buttonCollapse.setVisible(true);

    treePanel.add(expandCollapse);
    treePanel.add(cellTree);
    leftPanel.add(treePanel);

    SimplePanel bottomSavePanel = new SimplePanel();
    bottomSavePanel.getElement().setId("bottomSavePanel_SimplePanel");
    bottomSavePanel.setStyleName("div-first buttonPadding");
    VerticalPanel vp = new VerticalPanel();
    HorizontalPanel savePanel = new HorizontalPanel();
    savePanel.getElement().setId("savePanel_VerticalPanel");
    savePanel.add(new SpacerWidget());
    //		savePanel.add(errorMessageDisplay);
    vp.add(successMessageDisplay);
    //		saveBtn.setTitle("Ctrl+Alt+s");
    savePanel.add(saveBtn);
    validateBtn.setTitle("Validate");
    savePanel.add(validateBtn);
    vp.add(warningMessageDisplay);
    vp.add(savePanel);
    bottomSavePanel.add(vp);

    SimplePanel errPanel = new SimplePanel();
    errPanel.getElement().setId("errPanel_SimplePanel");
    errPanel.add(errorMessageDisplay);
    mainPanel.add(errPanel);
    mainPanel.add(leftPanel);
    mainPanel.add(rightPanel);
    mainPanel.add(bottomSavePanel);
    focusPanel.addKeyDownHandler(this);
    focusPanel.addFocusHandler(this);
    cellTreeHandlers();
  }
예제 #2
0
 private FocusPanel newRedFocusPanel(int i) {
   FocusPanel panel = new FocusPanel();
   panel.getElement().getStyle().setBackgroundColor("red");
   String id = "box" + i;
   panel.ensureDebugId(id);
   panel.add(new Label(id));
   panel.setPixelSize(100, 100);
   return panel;
 }
예제 #3
0
  public FilesListPanel() {
    super();
    // Create the toolbar
    toolbar = new FilesToolbar(this);
    SimplePanel toolbarWrapper = new SimplePanel();
    toolbarWrapper.add(toolbar);
    toolbarWrapper.setStyleName("files-toolbar"); // $NON-NLS-1$
    add(toolbarWrapper);

    SimplePanel filesListWrapper = new SimplePanel();
    FocusPanel fp =
        new FocusPanel(filesList) {
          public void onBrowserEvent(Event event) {
            if ((DOM.eventGetType(event) & Event.ONKEYDOWN) == Event.ONKEYDOWN) {
              if (event.getKeyCode() == KeyCodes.KEY_UP) {
                selectPreviousItem(selectedFileItem);
              } else if (event.getKeyCode() == KeyCodes.KEY_DOWN) {
                selectNextItem(selectedFileItem);
              } else if (event.getKeyCode() == KeyCodes.KEY_ENTER) {
                SolutionBrowserPerspective sbp = SolutionBrowserPerspective.getInstance();
                FilesListPanel flp = sbp.getFilesListPanel();
                sbp.openFile(
                    "/"
                        + flp.getSelectedFileItem().getSolution()
                        + flp.getSelectedFileItem().getPath(),
                    flp.getSelectedFileItem().getName(),
                    flp.getSelectedFileItem().getLocalizedName(),
                    COMMAND.RUN);
              }
            }
            super.onBrowserEvent(event);
          }
        };
    filesList.setCellPadding(1);
    filesList.setWidth("100%");
    AbsolutePanel bounderyPanel = new AbsolutePanel();
    bounderyPanel.add(fp);

    fp.sinkEvents(Event.KEYEVENTS);

    filesListWrapper.add(bounderyPanel);
    fp.getElement()
        .getStyle()
        .setProperty("margin", "29px 0px 10px 0px"); // $NON-NLS-1$ //$NON-NLS-2$
    filesListWrapper.setStyleName("files-list-panel"); // $NON-NLS-1$
    add(filesListWrapper);

    setStyleName("panelWithTitledToolbar"); // $NON-NLS-1$
    setWidth("100%"); // $NON-NLS-1$

    getElement().setId("filesListPanel");

    setupNativeHooks(this);

    SolutionDocumentManager.getInstance().addSolutionDocumentListener(this);
  }
예제 #4
0
 private Widget createWidget(boolean focusable, Object child) {
   if (child instanceof AEntity) {
     AEntity entity = (AEntity) child;
     FocusPanel focusPanel = Widgets.clickable(Widgets.widget(entity));
     // focusable.getel // TODO
     focusPanel.getElement().getStyle().setPadding(Widgets.defaultSpacing, Unit.PX);
     Widgets.addGotoEntityClickHandler(focusPanel, entity);
     return focusPanel;
   }
   return Widgets.widget(child);
 }
예제 #5
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);
  }
예제 #6
0
 @Inject
 public FilterViewImpl() {
   // Setting the Range for the Sliders
   lengthSlider = new RangeSlider();
   lengthSlider.setMin(Boundaries.MIN_LENGTH);
   lengthSlider.setMax(Boundaries.MAX_LENGTH);
   lengthSlider.setWidth("70%");
   lengthSlider.setValue(new Range(Boundaries.MIN_LENGTH, Boundaries.MAX_LENGTH));
   yearSlider = new RangeSlider();
   yearSlider.setWidth("70%");
   yearSlider.setMin(Boundaries.MIN_YEAR);
   yearSlider.setMax(Boundaries.MAX_YEAR);
   yearSlider.setValue(new Range(Boundaries.MIN_YEAR, Boundaries.MAX_YEAR));
   initWidget(uiBinder.createAndBindUi(this));
   collapseBox.setIn(true);
   // Setting Up Listening for Enter Pressed Events to start the search
   focusPanel.addKeyDownHandler(
       new KeyDownHandler() {
         @Override
         public void onKeyDown(KeyDownEvent event) {
           if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
             filterPresenter.onSearch();
           }
         }
       });
 }
예제 #7
0
 private void initializeCanvas() {
   panel.setSize(50 + 1 + graphWidth + "px", 25 + graphHeight + "px");
   canvas.setWidth(graphWidth);
   canvas.setHeight(graphHeight);
   canvas.getElement().getStyle().setPropertyPx("width", graphWidth);
   canvas.getElement().getStyle().setPropertyPx("height", graphHeight);
 }
예제 #8
0
파일: Table.java 프로젝트: dematey/ephesoft
  public Table(
      int totalCount,
      TableHeader header,
      boolean requireRadioButton,
      boolean fireEventForFirstRow,
      final DoubleClickListner doubleClickListner) {
    super();
    initWidget(BINDER.createAndBindUi(this));
    this.totalCount = totalCount;
    this.fireEventForFirstRow = fireEventForFirstRow;
    tableData = new TableData();
    tableData.setHeader(header);
    this.requireRadioButton = requireRadioButton;
    navBar = new NavBar(this);
    mouseOn = false;
    if (doubleClickListner != null && totalCount != 0) {
      focusPanel.addMouseOutHandler(
          new MouseOutHandler() {

            @Override
            public void onMouseOut(MouseOutEvent arg0) {
              mouseOn = false;
            }
          });

      focusPanel.addMouseOverHandler(
          new MouseOverHandler() {

            @Override
            public void onMouseOver(MouseOverEvent arg0) {
              mouseOn = true;
            }
          });

      addDoubleClickHandler(
          new DoubleClickHandler() {

            @Override
            public void onDoubleClick(DoubleClickEvent arg0) {
              if (mouseOn) {
                doubleClickListner.onDoubleClickTable();
              }
            }
          });
    }
  }
예제 #9
0
  /** Creates a new instance of PopupDatePicker */
  public PopupDatePicker() {

    Binding b = new Binding(label, "value", null, base, "value", converter);
    b.setLeft();
    b.bind();
    pp.setWidget(base);
    this.hp.add(this.label);
    this.hp.add(this.icon);
    fp.setWidget(hp);
    this.initWidget(fp);
    this.setStyleName("gwittir-PopupDatePicker");
    icon.addClickListener(
        new ClickListener() {
          public void onClick(Widget sender) {
            fp.setFocus(true);
            if (pp.isAttached()) {
              pp.hide();
            } else {
              int width = Window.getClientWidth() + Window.getScrollLeft();
              pp.setPopupPosition(getAbsoluteLeft(), getAbsoluteTop() + getOffsetHeight());
              base.addCalendarListener(
                  new CalendarListener() {
                    public boolean onDateClicked(Calendar calendar, Date date) {
                      if (date.getMonth() != base.getRenderDate().getMonth()
                          || date.getYear() != base.getRenderDate().getYear()) {
                        return true;
                      }
                      pp.hide();
                      calendar.removeCalendarListener(this);
                      return true;
                    }
                  });
              pp.show();
              if (pp.getPopupLeft() + base.getOffsetWidth() > width) {
                pp.setPopupPosition(
                    pp.getPopupLeft() + (width - pp.getPopupLeft() - base.getOffsetWidth()),
                    pp.getPopupTop());
              }
            }
          }
        });
    this.base.addPropertyChangeListener(
        "value",
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent evt) {
            if (!hasFirstSet) {
              hasFirstSet = true;
            } else {
              changes.firePropertyChange("value", evt.getOldValue(), evt.getNewValue());
            }
          }
        });
  }
예제 #10
0
 /**
  * The constructor should first call super() to initialize the component and then handle any
  * initialization relevant to Vaadin.
  */
 public VCytographer() {
   panel = new FocusPanel();
   panel.setSize(graphWidth + "px", graphHeight + "px");
   panel.addKeyDownHandler(this);
   panel.addKeyUpHandler(this);
   canvas = new VFocusDrawingArea(this, graphWidth, graphHeight);
   canvas.addKeyDownHandler(this);
   canvas.addKeyUpHandler(this);
   canvas.addMouseMoveHandler(this);
   canvas.addDoubleClickHandler(this);
   canvas.addMouseUpHandler(this);
   canvas.addMouseDownHandler(this);
   canvas.addClickHandler(this);
   canvas.addMouseWheelHandler(this);
   graph = new VGraph(this, style, canvas, graphWidth, graphHeight);
   panel.add(canvas);
   canvas.add(graph);
   initWidget(panel);
   setStyleName(CLASSNAME);
   DOM.setStyleAttribute(canvas.getElement(), "border", "1px solid black");
   disableContextMenu(canvas.getElement());
 }
예제 #11
0
 @Override
 protected void onLoad() {
   super.onLoad();
   addKeyDownHandler(
       new KeyDownHandler() {
         @Override
         public void onKeyDown(KeyDownEvent event) {
           if (event.getNativeKeyCode() == KeyCodes.KEY_DOWN
               && selectedIdx_ < (panel_.getWidgetCount() - 1)) {
             setSelectedIndex(selectedIdx_ + 1, true);
           } else if (event.getNativeKeyCode() == KeyCodes.KEY_UP & selectedIdx_ > 0) {
             setSelectedIndex(selectedIdx_ - 1, true);
           }
         }
       });
 }
예제 #12
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));
  }
  public GameControlPanel() {
    super();
    childPanel = new FlowPanel();
    childPanel.setHeight("100%");
    childPanel.setWidth("100%");
    super.add(childPanel);
    this.setStyleName("control_game_panel");
    this.initKeyModifierHandlers();
    this.setFocus(true);
    Window.addResizeHandler(
        new ResizeHandler() {

          @Override
          public void onResize(ResizeEvent event) {
            GameControlPanel.this.onResize();
          }
        });
  }
예제 #14
0
  public void setCurrentUser(UIRosterEntry currentUser) {
    this.currentUser = currentUser;
    rl.setCurrentUser(currentUser);

    //		consoleLayout.addWidgetToID("show_items_navigation",
    // rl.getResourceListPanel().getListBrowseControl());
    consoleLayout.addWidgetToID("leftpod_middle_items", rl.getResourceTypeListPanel());

    FocusPanel fp = new FocusPanel();
    fp.add(rl.getLhsLink());
    fp.setWidth("100%");
    fp.addClickListener(rl.getListPanelLhsLinkClickListener());
    consoleLayout.addWidgetToID("share_button_wrapper", fp);

    FocusPanel fp1 = new FocusPanel();
    fp1.add(rl.getRhsLink());
    fp1.setWidth("100%");
    fp1.addClickListener(rl.getListPanelRhsLinkClickListener());
    consoleLayout.addWidgetToID("items_manage", fp1);
  }
예제 #15
0
 /**
  * Create a Focus Panel
  *
  * @param widget
  * @param clickListener
  * @param focusListener
  * @param keyboardListener
  * @param mouseListener
  * @return
  */
 public static FocusPanel focusPanel(
     Widget widget,
     ClickListener clickListener,
     FocusListener focusListener,
     KeyboardListener keyboardListener,
     MouseListener mouseListener) {
   FocusPanel panel = GWT.create(FocusPanel.class);
   if (clickListener != null) panel.addClickListener(clickListener);
   if (focusListener != null) panel.addFocusListener(focusListener);
   if (keyboardListener != null) panel.addKeyboardListener(keyboardListener);
   if (mouseListener != null) panel.addMouseListener(mouseListener);
   panel.setWidget(widget);
   return panel;
 }
 /* (non-Javadoc)
  * @see com.google.gwt.event.dom.client.FocusHandler#onFocus(com.google.gwt.event.dom.client.FocusEvent)
  */
 @Override
 public void onFocus(FocusEvent event) {
   focusPanel.setStyleName("focusPanel");
 }
예제 #17
0
  /**
   * Listen for events that will move the knob.
   *
   * @param event the event that occurred
   */
  @Override
  public void onBrowserEvent(Event event) {
    super.onBrowserEvent(event);
    if (enabled) {
      switch (DOM.eventGetType(event)) {
          // Unhighlight and cancel keyboard events
        case Event.ONBLUR:
          keyTimer.cancel();
          if (slidingMouse) {
            DOM.releaseCapture(getElement());
            slidingMouse = false;
            slideKnob(event);
            stopSliding(true, true);
          } else if (slidingKeyboard) {
            slidingKeyboard = false;
            stopSliding(true, true);
          }
          unhighlight();
          break;

          // Highlight on focus
        case Event.ONFOCUS:
          highlight();
          break;

          // Mousewheel events
        case Event.ONMOUSEWHEEL:
          int velocityY = DOM.eventGetMouseWheelVelocityY(event);
          DOM.eventPreventDefault(event);
          if (velocityY > 0) {
            shiftRight(1);
          } else {
            shiftLeft(1);
          }
          break;

          // Shift left or right on key press
        case Event.ONKEYDOWN:
          if (!slidingKeyboard) {
            int multiplier = 1;
            if (DOM.eventGetCtrlKey(event)) {
              multiplier = (int) (getTotalRange() / stepSize / 10);
            }

            switch (DOM.eventGetKeyCode(event)) {
              case KeyCodes.KEY_HOME:
                DOM.eventPreventDefault(event);
                setCurrentValue(minValue);
                break;
              case KeyCodes.KEY_END:
                DOM.eventPreventDefault(event);
                setCurrentValue(maxValue);
                break;
              case KeyCodes.KEY_LEFT:
                DOM.eventPreventDefault(event);
                slidingKeyboard = true;
                startSliding(false, true);
                shiftLeft(multiplier);
                keyTimer.schedule(400, false, multiplier);
                break;
              case KeyCodes.KEY_RIGHT:
                DOM.eventPreventDefault(event);
                slidingKeyboard = true;
                startSliding(false, true);
                shiftRight(multiplier);
                keyTimer.schedule(400, true, multiplier);
                break;
              case 32:
                DOM.eventPreventDefault(event);
                setCurrentValue(minValue + getTotalRange() / 2);
                break;
            }
          }
          break;
          // Stop shifting on key up
        case Event.ONKEYUP:
          keyTimer.cancel();
          if (slidingKeyboard) {
            slidingKeyboard = false;
            stopSliding(true, true);
          }
          break;

          // Mouse Events
        case Event.ONMOUSEDOWN:
          setFocus(true);
          slidingMouse = true;
          DOM.setCapture(getElement());
          startSliding(true, true);
          DOM.eventPreventDefault(event);
          slideKnob(event);
          break;
        case Event.ONMOUSEUP:
          if (slidingMouse) {
            DOM.releaseCapture(getElement());
            slidingMouse = false;
            slideKnob(event);
            stopSliding(true, true);
          }
          break;
        case Event.ONMOUSEMOVE:
          if (slidingMouse) {
            slideKnob(event);
          }
          break;
      }
    }
  }
  @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);
            }
          }
        });
  }
예제 #19
0
  public ConsoleMiddleLeftPanel(
      MainLayout consoleLayout, UIRosterEntry currentUser, UserCallbacks ucb) {
    this.currentUser = currentUser;
    this.consoleLayout = consoleLayout;

    ul = new UserRoster(currentUser, ucb);
    rl = new ResourceRoster(currentUser, ucb);
    // some resource call backs are required by the user
    ul.getUserList().setResCallBacks(rl.getResourceManager().getSharingController());

    consoleLayout.addWidgetToID(
        "participants_navigation", ul.getUsersListPanel().getListBrowseControl());

    ul.getUserList()
        .addListModelListener(
            new DefaultListModelListener() {
              public void listEntryAdded(ListEntry newEntry) {
                addParticpantsHeader(
                    UIStrings.getParticipantsLabel()
                        + " ("
                        + (ul.getUserList().getListSize())
                        + ")");
              }

              public void listEntryRemoved(ListEntry removedEntry) {
                addParticpantsHeader(
                    UIStrings.getParticipantsLabel()
                        + " ("
                        + (ul.getUserList().getListSize())
                        + ")");
              }
            });

    consoleLayout.addWidgetToID("leftpod_middle_users", ul.getListPanel());
    if (null != ul.getLhsLink()
        && ("true".equalsIgnoreCase(ConferenceGlobals.getShowInviteLinks()))) {
      FocusPanel fp = new FocusPanel();
      fp.add(ul.getLhsLink());
      fp.setWidth("100%");
      fp.addClickListener(ul.getListPanelLhsLinkClickListener());
      consoleLayout.addWidgetToID("users_invite", fp);
    } else {
      consoleLayout.setIDVisibility("users_invite_btn", false);
    }

    FocusPanel fp1 = new FocusPanel();
    fp1.add(ul.getRhsLink());
    fp1.setWidth("100%");
    fp1.addClickListener(ul.getListPanelRhsLinkClickListener());
    consoleLayout.addWidgetToID("participants_manage", fp1);

    if (!UIGlobals.isPresenter(currentUser)) {
      // hide the div of show items
      consoleLayout.setIDVisibility("main_showitems", false);
    }

    addResourcesHeader(UIStrings.getShowItemsLabel() + " (0)");
    rl.getResourceList()
        .addListModelListener(
            new DefaultListModelListener() {
              public void listEntryAdded(ListEntry newEntry) {
                addResourcesHeader(
                    UIStrings.getShowItemsLabel()
                        + " ("
                        + (rl.getResourceList().getListSize())
                        + ")");
              }

              public void listEntryRemoved(ListEntry removedEntry) {
                addResourcesHeader(
                    UIStrings.getShowItemsLabel()
                        + " ("
                        + (rl.getResourceList().getListSize())
                        + ")");
              }
            });
    setCurrentUser(currentUser);

    if (!UIGlobals.isActivePresenter(currentUser)) {
      consoleLayout.setIDVisibility("main_showitems", false);
    } else {
      consoleLayout.setIDVisibility("main_showitems", true);
    }
  }
예제 #20
0
 public void addFocusListener(FocusListener listener) {
   fp.addFocusListener(listener);
 }
예제 #21
0
 public void removeFocusListener(FocusListener listener) {
   fp.removeFocusListener(listener);
 }
예제 #22
0
  @Override
  public void init() {

    clock = THREE.Clock();

    WIDTH = (int) getWindowInnerWidth();
    HEIGHT = (int) getWindowInnerHeight();

    windowHalfX = (int) (getWindowInnerWidth() / 2);
    windowHalfY = (int) (getWindowInnerHeight() / 2);

    FocusPanel container = createContainerPanel();

    // renderer
    renderer = THREE.WebGLRenderer(WebGLRendererParameter.create().antialias(true));
    renderer.setPixelRatio(GWTThreeUtils.getWindowDevicePixelRatio());
    renderer.setSize(WIDTH, HEIGHT);
    container.getElement().appendChild(renderer.getDomElement());

    renderer.getShadowMap().setEnabled(true); // renderer.shadowMap.enabled = true;
    renderer
        .getShadowMap()
        .setType(THREE.PCFSoftShadowMap); // renderer.shadowMap.type = THREE.PCFSoftShadowMap;

    //

    renderer.setGammaInput(true); // renderer.gammaInput = true;
    renderer.setGammaOutput(true); // renderer.gammaOutput = true;

    // scene
    scene = THREE.Scene();
    scene.setFog(THREE.Fog(0x00aaff, 1000, FAR));

    // camera
    camera = THREE.PerspectiveCamera(45, getWindowInnerWidth() / getWindowInnerHeight(), 2, FAR);
    camera.getPosition().set(500, 400, 1200);

    cubeCamera = THREE.CubeCamera(1, FAR, 128);
    scene.add(cubeCamera);

    Canvas x = Canvas.createIfSupported();
    Context2d xc = x.getContext2d();
    x.setSize(128 + "px", 128 + "px");

    xc.setFillStyle("#fff");
    xc.fillRect(0, 0, 128, 128);
    xc.setFillStyle("#000");
    xc.fillRect(0, 0, 64, 64);
    xc.setFillStyle("#999");
    xc.fillRect(32, 32, 32, 32);
    xc.setFillStyle("#000");
    xc.fillRect(64, 64, 64, 64);
    xc.setFillStyle("#555");
    xc.fillRect(96, 96, 32, 32);

    CanvasTexture texturePattern = THREE.CanvasTexture(x.getCanvasElement()); // var
    // texturePattern
    // =
    // new
    // THREE.CanvasTexture(
    // x
    // )
    texturePattern.setFormat(THREE.RGBFormat); // texturePattern.format =
    // THREE.RGBFormat;
    texturePattern.getRepeat().set(1000, 1000); // texturePattern.repeat.set(
    // 1000, 1000 );
    texturePattern.setWrapS(THREE.RepeatWrapping); // texturePattern.wrapS =
    // THREE.RepeatWrapping;
    texturePattern.setWrapT(THREE.RepeatWrapping); // texturePattern.wrapT =
    // THREE.RepeatWrapping;

    Texture textureSquares =
        ImageUtils.loadTexture("textures/patterns/bright_squares256.png"); // var
    // textureSquares
    // =
    // THREE.ImageUtils.loadTexture(
    // "textures/patterns/bright_squares256.png"
    // );
    textureSquares.getRepeat().set(50, 50); // textureSquares.repeat.set( 50,
    // 50 );
    textureSquares.setWrapS(THREE.RepeatWrapping); // textureSquares.wrapS =
    // textureSquares.wrapT
    // =
    // THREE.RepeatWrapping;
    textureSquares.setWrapT(THREE.RepeatWrapping);
    textureSquares.setMagFilter(THREE.NearestFilter); // textureSquares.magFilter
    // =
    // THREE.NearestFilter;
    textureSquares.setFormat(THREE.RGBFormat); // textureSquares.format =
    // THREE.RGBFormat;

    Texture textureNoiseColor = ImageUtils.loadTexture("textures/disturb.jpg"); // var
    // textureNoiseColor
    // =
    // THREE.ImageUtils.loadTexture(
    // "textures/disturb.jpg"
    // );
    textureNoiseColor.getRepeat().set(1, 1); // textureNoiseColor.repeat.set(
    // 1, 1 );
    textureNoiseColor.setWrapS(THREE.RepeatWrapping); // textureNoiseColor.wrapS
    // =
    // textureNoiseColor.wrapT
    // =
    // THREE.RepeatWrapping;
    textureNoiseColor.setWrapT(THREE.RepeatWrapping);
    textureNoiseColor.setFormat(THREE.RGBFormat); // textureNoiseColor.format
    // = THREE.RGBFormat;

    Texture textureLava = ImageUtils.loadTexture("textures/lava/lavatile.jpg"); // var
    // textureLava
    // =
    // THREE.ImageUtils.loadTexture(
    // "textures/lava/lavatile.jpg"
    // );
    textureLava.getRepeat().set(6, 2); // textureLava.repeat.set( 6, 2 );
    textureLava.setWrapS(THREE.RepeatWrapping); // textureLava.wrapS =
    // textureLava.wrapT =
    // THREE.RepeatWrapping;
    textureLava.setWrapT(THREE.RepeatWrapping);
    textureLava.setFormat(THREE.RGBFormat); // textureLava.format =
    // THREE.RGBFormat;

    String path = "textures/cube/SwedishRoyalCastle/"; // var path =
    // "textures/cube/SwedishRoyalCastle/";
    String format = ".jpg"; // var format = '.jpg';
    String[] urls = {
      path + "px" + format,
      path + "nx" + format,
      path + "py" + format,
      path + "ny" + format,
      path + "pz" + format,
      path + "nz" + format
    };
    ;

    Texture reflectionCube = ImageUtils.loadTextureCube(JavaScriptUtils.toArray(urls)); // var
    // reflectionCube
    // =
    // THREE.ImageUtils.loadTextureCube(
    // urls
    // );

    // ground

    MeshPhongMaterial groundMaterial =
        THREE.MeshPhongMaterial(
            GWTParamUtils.MeshPhongMaterial()
                .shininess(80)
                .color(0xffffff)
                .specular(0xffffff)
                .map(textureSquares)); // var groundMaterial = new
    // THREE.MeshPhongMaterial( {shininess:
    // 80,color: 0xffffff,specular:
    // 0xffffff,map: textureSquares} );
    PlaneBufferGeometry planeGeometry = THREE.PlaneBufferGeometry(100, 100); // var
    // planeGeometry
    // =
    // new
    // THREE.PlaneBufferGeometry(
    // 100,
    // 100
    // );

    Mesh ground = THREE.Mesh(planeGeometry, groundMaterial); // var ground =
    // new
    // THREE.Mesh(
    // planeGeometry,
    // groundMaterial
    // );
    ground.getPosition().set(0, 0, 0); // ground.position.set( 0, 0, 0 );
    ground.getRotation().setX(-Math.PI / 2); // ground.rotation.x = - Math.PI
    // / 2;
    ground.getScale().set(1000, 1000, 1000); // ground.scale.set( 1000, 1000,
    // 1000 );

    ground.setReceiveShadow(true); // ground.receiveShadow = true;

    scene.add(ground);

    // materials
    Shader shader = ShaderLib.cube();
    shader.uniforms().set("tCube", cubeCamera.getRenderTarget()); // shader.uniforms[
    // "tCube"
    // ].texture
    // =
    // cubeCamera.renderTarget;
    shader.uniforms().set("tFlip", 1); // shader.uniforms[ "tFlip" ].value =
    // 1;

    ShaderMaterial materialCube =
        THREE.ShaderMaterial(
            GWTParamUtils.ShaderMaterial()
                .fragmentShader(shader.fragmentShader())
                .vertexShader(shader.vertexShader())
                .uniforms(shader.uniforms())); // var
    // materialCube
    // =
    // new
    // THREE.ShaderMaterial(
    // {fragmentShader:
    // shader.fragmentShader,vertexShader:
    // shader.vertexShader,uniforms:
    // shader.uniforms}
    // );

    MeshPhongMaterial materialLambert =
        THREE.MeshPhongMaterial(
            GWTParamUtils.MeshPhongMaterial()
                .shininess(50)
                .color(0xffffff)
                .map(textureNoiseColor)); // var
    // materialLambert
    // =
    // new
    // THREE.MeshPhongMaterial(
    // {
    // shininess:
    // 50,
    // color:
    // 0xffffff,
    // map:
    // textureNoiseColor
    // }
    // );
    MeshPhongMaterial materialPhong =
        THREE.MeshPhongMaterial(
            GWTParamUtils.MeshPhongMaterial()
                .shininess(50)
                .color(0xffffff)
                .specular(0x999999)
                .map(textureLava)); // var materialPhong = new
    // THREE.MeshPhongMaterial( { shininess: 50,
    // color: 0xffffff, specular: 0x999999, map:
    // textureLava } );

    MeshPhongMaterial materialPhongCube =
        THREE.MeshPhongMaterial(
            GWTParamUtils.MeshPhongMaterial()
                .shininess(50)
                .color(0xffffff)
                .specular(0x999999)
                .envMap(cubeCamera.getRenderTarget().gwtCastTexture())); // var
    // materialPhongCube
    // = new
    // THREE.MeshPhongMaterial(
    // {
    // shininess:
    // 50,
    // color:
    // 0xffffff,
    // specular:
    // 0x999999,
    // envMap:
    // cubeCamera.renderTarget
    // } );
    // stats

    // object
    SphereGeometry sphereGeometry = THREE.SphereGeometry(100, 64, 32); // var
    // sphereGeometry
    // =
    // new
    // THREE.SphereGeometry(
    // 100,
    // 64,
    // 32
    // );
    TorusGeometry torusGeometry = THREE.TorusGeometry(240, 60, 32, 64); // var
    // torusGeometry
    // =
    // new
    // THREE.TorusGeometry(
    // 240,
    // 60,
    // 32,
    // 64
    // );
    BoxGeometry cubeGeometry = THREE.BoxGeometry(150, 150, 150); // var
    // cubeGeometry
    // = new
    // THREE.BoxGeometry(
    // 150, 150,
    // 150 );

    addObject(torusGeometry, materialPhong, 0, 100, 0, 0);
    addObject(cubeGeometry, materialLambert, 350, 75, 300, 0);
    mesh = addObject(sphereGeometry, materialPhongCube, 350, 100, -350, 0);

    BoxGeometry bigCube = THREE.BoxGeometry(50, 500, 50);
    BoxGeometry midCube = THREE.BoxGeometry(50, 200, 50);
    BoxGeometry smallCube = THREE.BoxGeometry(100, 100, 100);

    addObjectColor(bigCube, 0xff0000, -500, 250, 0, 0);
    addObjectColor(smallCube, 0xff0000, -500, 50, -150, 0);

    addObjectColor(midCube, 0x00ff00, 500, 100, 0, 0);
    addObjectColor(smallCube, 0x00ff00, 500, 50, -150, 0);

    addObjectColor(midCube, 0x0000ff, 0, 100, -500, 0);
    addObjectColor(smallCube, 0x0000ff, -150, 50, -500, 0);

    addObjectColor(midCube, 0xff00ff, 0, 100, 500, 0);
    addObjectColor(smallCube, 0xff00ff, -150, 50, 500, 0);

    addObjectColor(THREE.BoxGeometry(500, 10, 10), 0xffff00, 0, 600, 0, Math.PI / 4);
    addObjectColor(THREE.BoxGeometry(250, 10, 10), 0xffff00, 0, 600, 0, 0);

    addObjectColor(THREE.SphereGeometry(100, 32, 26), 0xffffff, -300, 100, 300, 0);

    JSONLoader loader = THREE.JSONLoader();
    loader.load(
        "models/animated/sittingBox.js",
        new JSONLoadHandler() {

          @Override
          public void loaded(Geometry geometry, JsArray<Material> materials) {
            MeshPhongMaterial morphMaterial =
                THREE.MeshPhongMaterial(
                    GWTParamUtils.MeshPhongMaterial()
                        .color(0x000000)
                        .specular(0xff9900)
                        .shininess(50)
                        .morphTargets(true)
                        .side(THREE.DoubleSide)
                        .shading(
                            THREE
                                .FlatShading)); // var morphMaterial = new THREE.MeshPhongMaterial(
                                                // { color: 0x000000, specular: 0xff9900, shininess:
                                                // 50, morphTargets: true, side: THREE.DoubleSide,
                                                // shading: THREE.FlatShading } );

            mesh =
                THREE.Mesh(
                    geometry, morphMaterial); // mesh = new THREE.Mesh( geometry, morphMaterial );

            mixer = THREE.AnimationMixer(mesh); // mixer = new THREE.AnimationMixer( mesh );

            mixer
                .clipAction(geometry.getAnimations().get(0))
                .setDuration(10)
                .play(); // mixer.addAction( new THREE.AnimationAction( geometry.animations[0]
                         // ).warpToDuration( 10 ) );

            double s = 200; // var s = 200;
            mesh.getScale().set(s, s, s); // mesh.scale.set( s, s, s );

            // morph.setDuration(8000);////morph.duration = 8000;
            // morph.setMirroredLoop(true);////morph.mirroredLoop = true;

            mesh.setCastShadow(true); // mesh.castShadow = true;
            mesh.setReceiveShadow(true); // mesh.receiveShadow = true;

            scene.add(mesh);
          }
        });

    double sunIntensity = 0.3;
    double pointIntensity = 1;
    int pointColor = 0xffaa00;

    if (DAY) {

      sunIntensity = 1;
      pointIntensity = 0.5;
      pointColor = 0xffffff;
    }

    ambientLight =
        THREE.AmbientLight(0x3f2806); // ambientLight = new THREE.AmbientLight( 0x3f2806 );
    scene.add(ambientLight);

    pointLight =
        THREE.PointLight(
            0xffaa00,
            pointIntensity,
            5000); // pointLight = new THREE.PointLight( 0xffaa00, pointIntensity, 5000 );
    pointLight.getPosition().set(0, 0, 0); // pointLight.position.set( 0, 0, 0 );
    scene.add(pointLight);

    sunLight =
        THREE.SpotLight(
            0xffffff,
            sunIntensity,
            0,
            Math.PI / 2,
            1); // sunLight = new THREE.SpotLight( 0xffffff, sunIntensity, 0, Math.PI/2, 1 );
    sunLight.getPosition().set(1000, 2000, 1000); // sunLight.position.set( 1000, 2000, 1000 );

    sunLight.setCastShadow(true); // sunLight.castShadow = true;

    sunLight.setShadowBias(-0.0002); // sunLight.shadowBias = -0.0002;

    sunLight.setShadowCameraNear(750); // sunLight.shadowCameraNear = 750;
    sunLight.setShadowCameraFar(4000); // sunLight.shadowCameraFar = 4000;
    sunLight.setShadowCameraFov(30); // sunLight.shadowCameraFov = 30;

    sunLight.setShadowCameraVisible(false); // sunLight.shadowCameraVisible = false;

    scene.add(sunLight);

    // trackball consume keydown event.this is the way to add keydown on root
    // TODO method

    GWTUtils.addKeyDownHandlerToDocument(
        new KeyDownHandler() {
          @Override
          public void onKeyDown(KeyDownEvent event) {

            if (event.getNativeKeyCode() == 78) {
              if (tweenDirection == 1) {

                tweenDay.stop();
                tweenNight.start();

                tweenDirection = -1;

              } else {

                tweenNight.stop();
                tweenDay.start();

                tweenDirection = 1;
              }
            }
          }
        });

    // control

    controls =
        THREEExp.TrackballControls(
            camera,
            renderer
                .getDomElement()); // controls = new THREE.TrackballControls( camera,
                                   // renderer.domElement );
    controls.getTarget().set(0, 120, 0); // controls.target.set( 0, 120, 0 );

    controls.setRotateSpeed(1.0); // controls.rotateSpeed = 1.0;
    controls.setZoomSpeed(1.2); // controls.zoomSpeed = 1.2;
    controls.setPanSpeed(0.8); // controls.panSpeed = 0.8;

    controls.setNoZoom(false); // controls.noZoom = false;
    controls.setNoPan(false); // controls.noPan = false;

    controls.setStaticMoving(true); // controls.staticMoving = true;
    controls.setDynamicDampingFactor(0.15); // controls.dynamicDampingFactor = 0.15;

    controls.setKeys(
        JavaScriptUtils.toArray(new int[] {65, 83, 68})); // controls.keys = [ 65, 83, 68 ];

    // Tween
    tweenDirection = -1;

    parameters = JSParameter.createParameter().set("control", 0);

    tweenDay =
        TWEEN.Tween(parameters).to("control", 1, 1000).easing(TWEEN.Easing_Exponential_Out());
    tweenNight =
        TWEEN.Tween(parameters).to("control", 0, 1000).easing(TWEEN.Easing_Exponential_Out());

    stats = Stats.create();
    stats.setPosition(0, 0);
    container.getElement().appendChild(stats.domElement());

    // add html info
    container.add(
        createAbsoluteHTML(
            "<div style='text:white'><a href='http://threejs.org' target='_blank'>three.js</a>  - test</a>",
            100,
            10));

    // handle resize & gui
    initResizeHandlerAndGUI();
    // setDebugAnimateOneTimeOnly(true);

  }
예제 #23
0
  @Inject
  public EditFolderView() {
    this.res = ShelfCBundle.INSTANCE;
    folderDescription =
        new FolderEditableTextAreaUc() {
          @Override
          public void onEditDisabled(String text) {
            descriptionAlertMessageLbl.addStyleName("titleAlertMessageDeActive");
            descriptionAlertMessageLbl.removeStyleName("titleAlertMessageActive");
            editFolderDescSaveButton.getElement().getStyle().setDisplay(Display.NONE);
            editFolderDescSaveButtonCancel.getElement().getStyle().setDisplay(Display.NONE);
            collectionDo.setGoals(text);
            getUiHandlers().updateCollectionInfo(collectionDo.getGooruOid(), null, text);
          }

          @Override
          public void checkCharacterLimit(String text) {
            if (text.length() >= 415) {
              descriptionAlertMessageLbl.addStyleName("titleAlertMessageActive");
              descriptionAlertMessageLbl.removeStyleName("titleAlertMessageDeActive");
            } else {
              descriptionAlertMessageLbl.addStyleName("titleAlertMessageDeActive");
              descriptionAlertMessageLbl.removeStyleName("titleAlertMessageActive");
            }
          }
        };

    folderTitle =
        new FolderEditableLabelUc() {
          @Override
          public void onEditDisabled(String text) {
            titleAlertMessageLbl.addStyleName("titleAlertMessageDeActive");
            titleAlertMessageLbl.removeStyleName("titleAlertMessageActive");
            collectionDo.setTitle(text);
            editFolderSaveButton.getElement().getStyle().setDisplay(Display.NONE);
            editFolderSaveButtonCancel.getElement().getStyle().setDisplay(Display.NONE);
            getUiHandlers().updateCollectionInfo(collectionDo.getGooruOid(), text, null);
          }

          @Override
          public void checkCharacterLimit(String text) {
            if (text.length() >= 50) {
              titleAlertMessageLbl.addStyleName("titleAlertMessageActive");
              titleAlertMessageLbl.removeStyleName("titleAlertMessageDeActive");
            } else {
              titleAlertMessageLbl.addStyleName("titleAlertMessageDeActive");
              titleAlertMessageLbl.removeStyleName("titleAlertMessageActive");
            }
          }
        };
    FolderCBundle.INSTANCE.css().ensureInjected();
    res.css().ensureInjected();
    setWidget(uiBinder.createAndBindUi(this));

    simplePencilFocPanel.addMouseOverHandler(new hideEditPencil());
    simplePencilFocPanel.addMouseOutHandler(new showEditPencil());
    collectionEditImageLbl.addClickHandler(new OnEditImageClick());
    editFolderTitle.addClickHandler(new OnEditImageClick());

    editFolderSaveButton.getElement().getStyle().setDisplay(Display.NONE);
    editFolderSaveButtonCancel.getElement().getStyle().setDisplay(Display.NONE);
    editFolderDescSaveButton.getElement().getStyle().setDisplay(Display.NONE);
    editFolderDescSaveButtonCancel.getElement().getStyle().setDisplay(Display.NONE);
    simplePencilPanel.getElement().getStyle().setDisplay(Display.NONE);
    backToSearchFloPanel.getElement().getStyle().setDisplay(Display.NONE);

    collectionDescriptionTitleContainer.addMouseOverHandler(new OnCollectionDescriptionClick());
    collectionDescriptionTitleContainer.addMouseOutHandler(new OnCollectionDescriptionOut());
    simplePencilPanel.addClickHandler(new OpenCollectionEditDescription());
    editFolderDesc.addClickHandler(new OpenCollectionEditDescription());

    myFolderRightContainer.addMouseOverHandler(new ActionPanelHover());
    myFolderRightContainer.addMouseOutHandler(new ActionPanelOut());

    folderDeleteLabel.setVisible(false);
    infoTabVc.addClickHandler(this);
    contentTabVc.addClickHandler(this);
    backToSearchHtml.addClickHandler(new BackToSearchHtmlClick());
    collectionEditImageLbl.setVisible(false);
  }