Examples of FlashAppletPanel


Examples of org.cast.cwm.mediaplayer.FlashAppletPanel

      return player;

    } else if (wicketId.startsWith("swf_")) {
     
      ResourceReference swfRef = getRelativeRef(elt.getAttribute("src"));
      return new FlashAppletPanel(wicketId, swfRef,
          Integer.valueOf(elt.getAttribute("width")),
          Integer.valueOf(elt.getAttribute("height")),
          "");

    } else if (wicketId.startsWith("feedbackButton_")) {
      ContentLoc loc = new ContentLoc(getModel().getObject());
      String responseGroupId = elt.getAttribute("rgid");
      IModel<Prompt> pm = responseService.getOrCreatePrompt(PromptType.FEEDBACK, loc, responseGroupId);
      ResponseFeedbackButtonPanel component = new ResponseFeedbackButtonPanel(wicketId, pm, responseFeedbackPanel);
      String forRole = elt.getAttribute("for");
      boolean usesTeacherButton = cwmSessionService.getUser().getRole().subsumes(Role.TEACHER);
      component.setVisibilityAllowed(usesTeacherButton ? forRole.equals("teacher") : forRole.equals("student"));
      component.add(new AttributeRemover("rgid", "for"));
      return component;
    } else if (wicketId.startsWith("scoreButtons_")) {
      IModel<Prompt> promptModel = getPrompt(elt);
      IModel<User> studentModel = ISISession.get().getTargetUserModel();
      ISortableDataProvider<Response> responseProvider = responseService.getResponseProviderForPrompt(promptModel, studentModel);
      TeacherScoreResponseButtonPanel component = new TeacherScoreResponseButtonPanel(wicketId, responseProvider);
      return component;
    } else if (wicketId.startsWith("showScore_")) {
      IModel<Prompt> promptModel = getPrompt(elt);
      IModel<User> studentModel = cwmSessionService.getUserModel();
      ISortableDataProvider<Response> responseProvider = responseService.getResponseProviderForPrompt(promptModel, studentModel);
      ScorePanel component = new StudentScorePanel(wicketId, responseProvider);
      return component;
    // A container for a single-select form and whiteboard, notebook links
    } else if (wicketId.startsWith("responseContainer")) {
      return new WebMarkupContainer(wicketId);
    // A single-select, multiple choice form.  MultipleChoiceItems will be added to a RadioGroup
    // child of this form. 
    } else if (wicketId.startsWith("select1_immediate_")) {
      return makeImmediateResponseForm(wicketId, elt);
    // A single-select, multiple choice form.  MultipleChoiceItems will be added to a RadioGroup
    // child of this form. 
    } else if (wicketId.startsWith("select1_delay_")) {
      return makeDelayedResponseForm(wicketId, elt);
    // buttons for viewing in whiteboard and notebook
    } else if (wicketId.startsWith("viewActions")) {
      IModel<Prompt> mPrompt = getPrompt(elt, PromptType.SINGLE_SELECT);
      Long promptId = mPrompt.getObject().getId();
      ResponseViewActionsPanel component = new ResponseViewActionsPanel(wicketId, promptId);
      component.add(new AttributeRemover("rgid", "title", "group", "type"));
      return component;
      // A single-select, multiple choice disabled form.  MultipleChoiceItems will be added to a RadioGroup
      // child of this form. 
    } else if (wicketId.startsWith("select1_view_immediate")) {
      return makeImmediateResponseView(wicketId, elt);
    // A single-select, multiple choice disabled form.  MultipleChoiceItems will be added to a RadioGroup
    // child of this form. 
    } else if (wicketId.startsWith("select1_view_delay")) {
      return makeDelayedResponseView(wicketId, elt);
    // A multiple choice radio button. Stores a "correct" value. This is
    // added to a generic RadioGroup in a SingleSelectForm.
    } else if (wicketId.startsWith("selectItem_")) {
      Component mcItem = new SingleSelectItem(wicketId,
          new Model<String>(wicketId.substring("selectItem_".length())),
          Boolean.valueOf(elt.getAttribute("correct")));
      mcItem.add(new AttributeRemover("correct"));
      return mcItem;

    // A message associated with a wicketId.startsWith("selectItem_").
    // The wicketId of the associated SingleSelectItem should be provided as a "for" attribute.
    // Visibility based on whether the corresponding radio button is selected in the enclosing form.
    } else if (wicketId.startsWith("selectMessage_")) {
      return new SingleSelectMessage(wicketId, elt.getAttribute("for")).add(new AttributeRemover("for"));

    // A delayed feedback message associated with a wicketId.startsWith("selectItem_").
    // The wicketId of the associated SingleSelectItem should be provided as a "for" attribute.
    // Visibility based on whether the response has been reviewed.
    } else if (wicketId.startsWith("selectDelayMessage_")) {
      ISIXmlSection section = getISIXmlSection();
      IModel<XmlSection> currentSectionModel = new XmlSectionModel(section);
      SingleSelectDelayMessage component = new SingleSelectDelayMessage(wicketId, currentSectionModel);
      return component.add(new AttributeRemover("for"));

    } else if (wicketId.startsWith("responseList_")) {
      ContentLoc loc = new ContentLoc(getModel().getObject());
      String responseGroupId = elt.getAttribute("rgid");
      ResponseMetadata metadata = getResponseMetadata(responseGroupId);
      IModel<Prompt> mPrompt = responseService.getOrCreatePrompt(PromptType.RESPONSEAREA, loc, responseGroupId, metadata.getCollection());
      ResponseList dataView = new ResponseList (wicketId, mPrompt, metadata, loc, ISISession.get().getTargetUserModel());
      dataView.setContext(getResponseListContext(false));
      dataView.setAllowEdit(!isTeacher);
      dataView.setAllowNotebook(!inGlossary && !isTeacher && ISIApplication.get().isNotebookOn());
      dataView.setAllowWhiteboard(!inGlossary && ISIApplication.get().isWhiteboardOn());
      dataView.add(new AttributeRemover("rgid", "group"));
      return dataView;

    } else if (wicketId.startsWith("locking_responseList_")) {
      ContentLoc loc = new ContentLoc(getModel().getObject());
      String responseGroupId = elt.getAttribute("rgid");
      ResponseMetadata metadata = getResponseMetadata(responseGroupId);
      IModel<Prompt> mPrompt = responseService.getOrCreatePrompt(PromptType.RESPONSEAREA, loc, responseGroupId, metadata.getCollection());
      ResponseList dataView = new LockingResponseList (wicketId, mPrompt, metadata, loc, ISISession.get().getTargetUserModel());
      dataView.setContext(getResponseListContext(false));
      dataView.setAllowNotebook(!inGlossary && !isTeacher && ISIApplication.get().isNotebookOn());
      dataView.setAllowWhiteboard(!inGlossary && ISIApplication.get().isWhiteboardOn());
      dataView.add(new AttributeRemover("rgid", "group"));
      return dataView;

    } else if (wicketId.startsWith("period_responseList_")) {
      ContentLoc loc = new ContentLoc(getModel().getObject());
      String responseGroupId = elt.getAttribute("rgid");
      ResponseMetadata metadata = getResponseMetadata(responseGroupId);
      IModel<Prompt> mPrompt = responseService.getOrCreatePrompt(PromptType.RESPONSEAREA, loc, responseGroupId, metadata.getCollection());
      PeriodResponseList dataView = new PeriodResponseList(wicketId, mPrompt, metadata, loc, ISISession.get().getCurrentPeriodModel());
      dataView.setContext(getResponseListContext(true));
      dataView.setAllowEdit(!isTeacher);
      dataView.setAllowNotebook(!inGlossary && !isTeacher && ISIApplication.get().isNotebookOn());
      dataView.setAllowWhiteboard(!inGlossary && ISIApplication.get().isWhiteboardOn());
      dataView.add(new AttributeRemover("rgid", "group"));
      return dataView;     
     
    } else if (wicketId.startsWith("responseButtons_")) {
      ContentLoc loc = new ContentLoc(getModel().getObject());
      String responseGroupId = elt.getAttribute("rgid");
      Element xmlElement = getModel().getObject().getElement().getOwnerDocument().getElementById(responseGroupId);
      ResponseMetadata metadata = new ResponseMetadata(xmlElement);
      if (!ISIApplication.get().isUseAuthoredResponseType()) {
        // set all the response types to the default per application configuration here
        metadata = addMetadata(metadata);
      }
      IModel<Prompt> mPrompt = responseService.getOrCreatePrompt(PromptType.RESPONSEAREA, loc, metadata.getId(), metadata.getCollection());
      ResponseButtons buttons = new ResponseButtons(wicketId, mPrompt, metadata, loc);
      buttons.setVisible(!isTeacher);
      return buttons;

    } else if (wicketId.startsWith("locking_responseButtons_")) {
      ContentLoc loc = new ContentLoc(getModel().getObject());
      String responseGroupId = elt.getAttribute("rgid");
      Element xmlElement = getModel().getObject().getElement().getOwnerDocument().getElementById(responseGroupId);
      ResponseMetadata metadata = new ResponseMetadata(xmlElement);
      if (!ISIApplication.get().isUseAuthoredResponseType()) {
        // set all the response types to the default per application configuration here
        metadata = addMetadata(metadata);
      }
      IModel<Prompt> mPrompt = responseService.getOrCreatePrompt(PromptType.RESPONSEAREA, loc, metadata.getId(), metadata.getCollection());
      return new LockingResponseButtons(wicketId, mPrompt, metadata, loc, cwmSessionService.getUserModel());

    } else if (wicketId.startsWith("ratePanel_")) {
      ContentLoc loc = new ContentLoc(getModel().getObject());
      String promptText = null;
      String ratingId = elt.getAttribute("id");
      NodeList nodes = elt.getChildNodes();
      // extract the prompt text authored - we might want to consider re-writing this
      // to use xsl instead of this - but this works for now - ldm
      for (int i=0; i<nodes.getLength(); i++) {
        Node nextNode = nodes.item(i);
        if (nextNode instanceof Element) {
          Element next = (Element)nodes.item(i);
          if (next.getAttribute("class").equals("prompt")) {
            //get all the html under the prompt element
            promptText = new TransformResult(next).getString();
          }
        }
      }
      RatePanel ratePanel = new RatePanel(wicketId, loc, ratingId, promptText);
      ratePanel.add(new AttributeRemover("id"));
      ratePanel.add(new AttributeRemover("type"));
      return ratePanel;

    } else if (wicketId.startsWith("teacherBar_")) {
      WebMarkupContainer teacherBar = new WebMarkupContainer(wicketId);
      teacherBar.setVisible(!cwmSessionService.getUser().getRole().equals(Role.STUDENT) && !inGlossary);
      return teacherBar;

    } else if (wicketId.startsWith("compareResponses_")) {
      IModel<Prompt> mPrompt = getPrompt(elt);
      BookmarkablePageLink<Page> bpl = new BookmarkablePageLink<Page>(wicketId, ISIApplication.get().getPeriodResponsePageClass());
      bpl.setParameter("promptId", mPrompt.getObject().getId());
      ISIApplication.get().setLinkProperties(bpl);
      bpl.setVisible(isTeacher);
      bpl.add(new AttributeRemover("rgid", "for", "type"));
      return bpl;

    } else if(wicketId.startsWith("agent_")) {
      String title = elt.getAttribute("title");
      if (Strings.isEmpty(title))
        title = new StringResourceModel("isi.defaultAgentButtonText", this, null, "Help").getObject();
      AgentLink link = new AgentLink(wicketId, title, elt.getAttribute("responseAreaId"));
      link.add(new AttributeRemover("title", "responseAreaId"));
      return link;
     
    } else if (wicketId.startsWith("image_")) {
      String src = elt.getAttribute("src");
      ResourceReference imgRef = getRelativeRef(src);
      return new Image(wicketId, imgRef);

    } else if (wicketId.startsWith("imageThumb_")) {     
      String src = elt.getAttribute("src");
      int ext = src.lastIndexOf('.');
      src = src.substring(0, ext) + "_t" + src.substring(ext);
      ResourceReference imgRef = getRelativeRef(src);
      Image img = new Image(wicketId, imgRef);
      // FIXME these attributes were removed because indira was adding height and width of the detail image
      // not the thumbnail image - remove when indira gets removed
      img.add(new AttributeRemover("width", "height"));
      return img;
     
    } else if (wicketId.startsWith("imageDetailButton_")) {
      // for thumbnail images only - no longer for more info
      return new ImageDetailButtonPanel(wicketId, wicketId.substring("imageDetailButton_".length()));
//      We may want to put some of this back, but for now assuming that any time XSLT requests an image detail button we'll put one in.
//      if (contentPage == null && !inGlossary) // Don't do imageDetails on non-content pages (e.g. the Table of Contents)
//        return new WebMarkupContainer(wicketId).setVisible(false);

    } else if (wicketId.startsWith("imgToggleHeader")
        || wicketId.startsWith("imgDetailToggleHeader")
        || wicketId.startsWith("objectToggleHeader")) {
      // long description header for toggle area

      String src = elt.getAttribute("src");

      // remove everything but the name of the media
      int lastIndex = src.lastIndexOf("/") + 1;
      src = src.substring(lastIndex, src.length());

      Label label;
      String eventType = "ld";
      String detail = null;
      if (wicketId.startsWith("img")) {
        label = new Label(wicketId, new ResourceModel("imageLongDescription.toggleHeading""image information"));
        String imageId = elt.getAttribute("imageId");
        detail = "imageId=" + imageId;
        label.add(new AttributeRemover("imageId"));
        if (wicketId.startsWith("imgDetailToggleHeader")) {
          label = new Label(wicketId, new ResourceModel("imageLongDescription.toggleHeading""image information"));
          detail = detail + ",context=detail";
        }
      } else { // video or mp3 files
        if (src.contains(".mp3")) {
          label = new Label(wicketId, new ResourceModel("audioLongDescription.toggleHeading""more audio information"));
        } else {
          label = new Label(wicketId, new ResourceModel("videoLongDescription.toggleHeading""more video information"));
        }
        detail = "src=" + src;
      }

      label.add(new CollapseBoxBehavior("onclick", eventType, ((ISIBasePage) getPage()).getPageName(), detail));
      label.add(new AttributeRemover("src"));
      return label;

    } else if (wicketId.startsWith("annotatedImage_")) {
      // image with hotspots
      AnnotatedImageComponent annotatedImageComponent = new AnnotatedImageComponent(wicketId, elt, getModel());
      annotatedImageComponent.add(new AttributeRemover("annotatedImageId"));
      return annotatedImageComponent;
     
    } else if (wicketId.startsWith("hotSpot_")) {
      // clickable areas on annotated images
      HotSpotComponent hotSpotComponent = new HotSpotComponent(wicketId, elt);
      hotSpotComponent.add(new AttributeRemover("annotatedImageId"));
      return hotSpotComponent;
     
    } else if (wicketId.startsWith("slideShow_")) {
      SlideShowComponent slideShowComponent = new SlideShowComponent(wicketId, elt);
      return slideShowComponent;
           
    } else if (wicketId.startsWith("collapseBox_")) {
      WebMarkupContainer collapseBox = new WebMarkupContainer(wicketId);
      return collapseBox;

    } else if (wicketId.startsWith("feedbackStatusIndicator_")) {
      FeedbackStatusIndicator feedbackStatusIndicator = new FeedbackStatusIndicator(wicketId);
      return feedbackStatusIndicator;

     
    } else if (wicketId.startsWith("collapseBoxControl-")) {
      String boxSequence = (wicketId.substring("collapseBoxControl-".length()).equals("") ? "0" : wicketId.substring("collapseBoxControl-".length()));
      CollapseBoxHeader collapseBoxHeader = new CollapseBoxHeader(wicketId, boxSequence);
      return collapseBoxHeader;

    } else if (wicketId.startsWith("iScienceLink-")) {     
      return new AjaxFallbackLink<Object>(wicketId) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
          target.prependJavascript("$('#iScienceVideo-" + wicketId.substring("iScienceLink-".length()) + "').jqmShow();");
          eventService.saveEvent("iscience:view", "Video #" + wicketId.substring("iScienceLink-".length()), ((ISIBasePage) getPage()).getPageName());
        }
      };

    } else if (wicketId.startsWith("youtube_")) {
      int width = getWidth(elt, 640);
      int height = getHeight(elt, 385);
      String src = elt.getAttribute("src");
      src = src.replace("youtube.com/watch?v=", "youtube.com/v/");

      FlashAppletPanel panel = new FlashAppletPanel(wicketId, width, height);
      panel.add(new AttributeRemover("src", "width", "height"));
      panel.setAppletHRef(src);
      panel.setFullScreen(true);
      return panel; 
     
    } else if (wicketId.startsWith("pageLinkPanel_")) {
      String id = elt.getAttribute("id");
      IModel<XmlSection> currentSectionModel = new XmlSectionModel(getModel().getObject().getXmlDocument().getById(id));
      PageLinkPanel panel = new PageLinkPanel(wicketId, currentSectionModel, null);
      panel.add(new AttributeRemover("id"));
      return panel;

    } else if (wicketId.startsWith("sectionStatusIcon_")) {
      String id = elt.getAttribute("id");
      IModel<XmlSection> currentSectionModel = new XmlSectionModel(getModel().getObject().getXmlDocument().getById(id));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.