Package org.jdesktop.wonderland.modules.portal.common

Examples of org.jdesktop.wonderland.modules.portal.common.PortalComponentServerState


    }

    @Override
    public CellComponentServerState getServerState(CellComponentServerState state) {
        if (state == null) {
            state = new PortalComponentServerState();
        }

  PortalComponentServerState serverState = (PortalComponentServerState) state;

        serverState.setServerURL(serverURL);
        serverState.setLocation(location);
        serverState.setLook(look);
  serverState.setAudioSourceType(audioSourceType);
  serverState.setAudioSource(audioSource);
  serverState.setUploadFile(uploadFile);
  serverState.setCachedAudioSource(cachedAudioSource);
  serverState.setVolume(volume);
       
        serverState.setBackgroundColor(backgroundColor);
        serverState.setTextColor(textColor);
        serverState.setImageURL(imageURL);
        serverState.setMessage(message);

        return super.getServerState(state);
    }
View Full Code Here


    @Override
    public void setServerState(CellComponentServerState state) {
        super.setServerState(state);

  PortalComponentServerState serverState = (PortalComponentServerState) state;

        serverURL = serverState.getServerURL();
        location = serverState.getLocation();
        look = serverState.getLook();
  audioSourceType = serverState.getAudioSourceType();
  audioSource = serverState.getAudioSource();
  uploadFile = serverState.getUploadFile();
  cachedAudioSource = serverState.getCachedAudioSource();
  volume = serverState.getVolume();
       
        backgroundColor = serverState.getBackgroundColor();
        textColor = serverState.getTextColor();
        imageURL = serverState.getImageURL();
        message = serverState.getMessage();
    }
View Full Code Here

    public String getDisplayName() {
        return BUNDLE.getString("Portal");
    }

    public <T extends CellComponentServerState> T getDefaultCellComponentServerState() {
        PortalComponentServerState state = new PortalComponentServerState();
        return (T) state;
    }
View Full Code Here

        mccss.setLightingEnabled(false);
        cellState.addComponentServerState(mccss);
       
        // add the portal state (by default this will send the user to the
        // origin)
        cellState.addComponentServerState(new PortalComponentServerState());
       
        // set the scaling to make the model smaller
        PositionComponentServerState pcss = new PositionComponentServerState();
        pcss.setScaling(new Vector3f(0.4f, 0.4f, 0.4f));
        cellState.addComponentServerState(pcss);
View Full Code Here

     */
    public void open() {
        // Fetch the current state from the Cell. If none exist, then just
        // return.
        CellServerState cellServerState = editor.getCellServerState();
        PortalComponentServerState state = (PortalComponentServerState)
                cellServerState.getComponentServerState(
                PortalComponentServerState.class);
        if (state == null) {
            return;
        }

        // Otherwise, update the values of the text fields and store away the
        // original values. We use the convention that an empty entry is
        // represented by an empty string ("") rather than null.

        // Fetch the destination URL from the server state. If the original
        // state is null, then convert it into an empty string and update the
        // text field.
        origServerURL = state.getServerURL();
        if (origServerURL == null || origServerURL.length() == 0) {
      origServerURL = LoginManager.getPrimary().getServerURL();
  }

        // Fetch the destination location from the server state. If the value
        // is null, then set the original values and text fields to empty
        // strings.
        Vector3f origin = state.getLocation();
        if (origin != null) {
            origX = origin.x;
            origY = origin.y;
            origZ = origin.z;
        } else {
            origX = 0;
            origY = 0;
            origZ = 0;
        }

        backgroundColor = state.getBackgroundColor();
        textColor = state.getTextColor();
        imageURL = state.getImageURL();
        message = state.getMessage();
       
        // Fetc the destination look direction from the server state. If the
        // value is null, then set the original value and text field to an
        // empty string.
        Quaternion lookAt = state.getLook();
        if (lookAt != null) {
            float lookDirection = (float) Math.toDegrees(lookAt.toAngleAxis(new Vector3f()));
            origLookDirection = lookDirection;
        } else {
            origLookDirection = 0;
        }

  origVolume = state.getVolume();

  if (state.getAudioSourceType() != null) {
      origAudioSourceType = state.getAudioSourceType();
  } else {
      origAudioSourceType = AudioSourceType.FILE;
  }

  origAudioSource = state.getAudioSource();
        if (origAudioSource == null) {
      origAudioSource = "";
  }

        // update list of placemarks
View Full Code Here

        origVolume = volumeConverter.getVolume(volumeSlider.getValue());
       
        // Figure out whether there already exists a server state for the
        // component. If not, then create one.
        CellServerState cellServerState = editor.getCellServerState();
        PortalComponentServerState state =
                (PortalComponentServerState) cellServerState.getComponentServerState(
                PortalComponentServerState.class);
        if (state == null) {
            //state = new PortalComponentServerState();
      return;
        }

        // Set the values in the server state from the text fields. If the text
        // fields are empty, they will return an empty string (""), this is
        // converted to null to set in the server state.

        state.setServerURL(origServerURL);

        // Set the location on the server state
        state.setLocation(new Vector3f(origX, origY, origZ));

        // Set the destination look direction from the text field. If the text
        // field is empty, then set the server state as a zero rotation.
        Quaternion look = new Quaternion();
        Vector3f axis = new Vector3f(0.0f, 1.0f, 0.0f);
        float angle = (float) Math.toRadians(origLookDirection);
  look.fromAngleAxis((float) angle, axis);
        state.setLook(look);

  state.setAudioSourceType(origAudioSourceType);
  state.setAudioSource(origAudioSource);
  state.setUploadFile(true);
  state.setVolume(origVolume);
       
        File image = cspp.getImage();
        String uri=cspp.getImageURL();
        if(image!=null) {
             uri = uploadImage(image);
        }
        state.setBackgroundColor(cspp.getBackColor());
        state.setTextColor(cspp.getTextColor());
        state.setImageURL(uri);
        state.setMessage(cspp.getMessage());
        String cacheFilePath;

  switch (audioSourceType) {
  case FILE:
      try {
          cacheFilePath = audioCacheHandler.cacheFile(origAudioSource);
      } catch (AudioCacheHandlerException e) {
    break;
            }


            try {
                audioCacheHandler.uploadFileAudioSource(origAudioSource);
            } catch (AudioCacheHandlerException e) {
            }
     

      state.setCachedAudioSource(cacheFilePath);
            break;

  case CONTENT_REPOSITORY:
      try {
    cacheFilePath =
        audioCacheHandler.cacheContent(urlTF.getText().trim(), origAudioSource);
      } catch (AudioCacheHandlerException e) {
    break;
      }

      state.setCachedAudioSource(cacheFilePath);
            break;

        case URL:
      try {
                cacheFilePath = audioCacheHandler.cacheURL(new URL(origAudioSource));
      } catch (Exception e) {
    errorMessage("Cache URL", "Unable to cache URL: " + e.getMessage());
    break;
      }

      state.setCachedAudioSource(cacheFilePath);
            break;
        }

        editor.addToUpdateList(state);
        setPanelDirty();
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.portal.common.PortalComponentServerState

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.