Package org.apache.wicket.markup.html.image

Examples of org.apache.wicket.markup.html.image.Image


                    attrhead.add(new Label("resource", propTO.getResource()));

                    attrhead.add(new Label("propagation", propTO.getStatus() == null
                            ? "UNDEFINED" : propTO.getStatus().toString()));

                    final Image image;
                    final String alt, title;
                    switch (propTO.getStatus()) {

                        case SUCCESS:
                        case SUBMITTED:
                        case CREATED:
                            image = new Image("icon", "statuses/active.png");
                            alt = "success icon";
                            title = "success";
                            break;

                        default:
                            image = new Image("icon", "statuses/inactive.png");
                            alt = "failure icon";
                            title = "failure";
                    }

                    image.add(new Behavior() {

                        private static final long serialVersionUID = 1469628524240283489L;

                        @Override
                        public void onComponentTag(final Component component, final ComponentTag tag) {
View Full Code Here


     * @param resourceName resource name
     * @param objectTO connector object TO
     * @return fragment.
     */
    private Fragment getStatusIcon(final String id, final String resourceName, final ConnObjectTO objectTO) {
        final Image image;
        final String alt, title;
        switch (statusUtils.getStatusBean(resourceName, objectTO).getStatus()) {

            case ACTIVE:
                image = new Image("status", "statuses/active.png");
                alt = "active icon";
                title = "Enabled";
                break;

            case SUSPENDED:
                image = new Image("status", "statuses/inactive.png");
                alt = "inactive icon";
                title = "Disabled";
                break;

            default:
                image = null;
                alt = null;
                title = null;
        }

        final Fragment frag;
        if (image == null) {
            frag = new Fragment(id, "emptyFrag", this);
        } else {
            image.add(new Behavior() {

                private static final long serialVersionUID = 1469628524240283489L;

                @Override
                public void onComponentTag(final Component component, final ComponentTag tag) {
View Full Code Here

            private static final long serialVersionUID = 4949588177564901031L;

            @Override
            protected void populateItem(final ListItem<StatusBean> item) {
                final Image image;
                final String alt, title;
                boolean checkVisibility = true;

                switch (item.getModelObject().getStatus()) {

                    case NOT_YET_SUBMITTED:
                        image = new Image("icon", "../statuses/undefined.png");
                        alt = "undefined icon";
                        title = "Not yet submitted";
                        break;

                    case ACTIVE:
                        image = new Image("icon", "../statuses/active.png");
                        alt = "active icon";
                        title = "Enabled";
                        break;

                    case UNDEFINED:
                        image = new Image("icon", "../statuses/undefined.png");
                        checkVisibility = false;
                        alt = "undefined icon";
                        title = "Undefined status";
                        break;

                    case OBJECT_NOT_FOUND:
                        image = new Image("icon", "../statuses/objectnotfound.png");
                        checkVisibility = false;
                        alt = "notfound icon";
                        title = "User not found";
                        break;

                    default:
                        image = new Image("icon", "../statuses/inactive.png");
                        alt = "inactive icon";
                        title = "Disabled";
                }

                image.add(new Behavior() {

                    private static final long serialVersionUID = 1469628524240283489L;

                    @Override
                    public void onComponentTag(final Component component, final ComponentTag tag) {
View Full Code Here

      protected void populateItem(ListItem<XmlSection> item) {
        XmlSection sec3 = item.getModelObject();
        ContentLoc loc = new ContentLoc(sec3);
        BookmarkablePageLink<ISIStandardPage> link = new SectionLinkFactory().linkToPage("link", sec3);
        if (locsWithUnread.contains(loc.getLocation()))
          link.add(new Image("messageIcon", new ResourceReference("img/icons/envelope_new.png")));
        else if (locsWithMessages.contains(loc.getLocation()))
          link.add(new Image("messageIcon", new ResourceReference("img/icons/envelope_old.png")));
        else
          link.add(new WebMarkupContainer("messageIcon").setVisible(false));
        item.add(link);
        link.add(new Label("number", String.valueOf(++pageNum)).setRenderBodyOnly(true));
      }
View Full Code Here

      return thumbRatingDescription;

    } else if (wicketId.startsWith("mediaThumbImage_")) {
      String src = elt.getAttribute("src");
      ResourceReference imgRef = getRelativeRef(src);
      Image image = new Image(wicketId, imgRef) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onComponentTag(final ComponentTag tag)
        {
          super.onComponentTag(tag);
            tag.put("width", elt.getAttribute("width"));
            tag.put("height", elt.getAttribute("height"));
        }
      };     
      return image;
     
    } else if (wicketId.startsWith("mediaThumbLink_")) {     
      String videoId = elt.getAttributeNS(null, "videoId");
      XmlSectionModel currentSectionModel = getModel();     
      VideoLink videoLink = new VideoLink(wicketId, videoId, currentSectionModel);
      videoLink.add(new AttributeRemover("videoId"));
      return videoLink;

    } else if (wicketId.startsWith("videoplayer_")) {
      final String videoSrc = elt.getAttribute("src");
      ResourceReference videoRef = getRelativeRef(videoSrc);
      String videoUrl = RequestCycle.get().urlFor(videoRef).toString();

      Integer width = Integer.valueOf(elt.getAttribute("width"));
      Integer height = Integer.valueOf(elt.getAttribute("height"));
      String preview = elt.getAttribute("poster");
      String captions = elt.getAttribute("captions");
      String audioDescription = elt.getAttribute("audiodescription");
     
      MediaPlayerPanel comp = new MediaPlayerPanel(wicketId, videoUrl, width, height) {
        private static final long serialVersionUID = 1L;
        @Override
        public void onPlay (String status) {
          if (cwmSessionService.isSignedIn())
            eventService.saveEvent("video:view", "id=" + elt.getAttribute("videoId") + ",state=" + status, contentPage);
        }
      };

      comp.setFullScreen(true);
      comp.setUseOnPlay(true);

      if (!Strings.isEmpty(preview))
        comp.setPreview(getRelativeRef(preview));
     
      if (!Strings.isEmpty(captions))
        comp.setCaptionFile(getRelativeRef(captions));
     
      if (!Strings.isEmpty(audioDescription))
        comp.setAudioDescriptionFile(getRelativeRef(audioDescription));
     
      comp.add(new AttributeRemover("src", "width", "height", "poster", "captions", "audiodescription", "videoId"));
     
      return comp;

    } else if (wicketId.startsWith("audioplayer_")) {
      String audioSrc = elt.getAttribute("src");
      ResourceReference audioRef = getRelativeRef(audioSrc);
      String audioUrl = RequestCycle.get().urlFor(audioRef).toString();

      int width = 400;
      if (!elt.getAttribute("width").equals("")) {
        try {
          width = Integer.parseInt(elt.getAttribute("width").trim());
        } catch (Exception e) {
          log.debug("Can't get width for {}: {}", audioUrl, e);
          width = 400;
        }
      }
      AudioPlayerPanel player = new AudioPlayerPanel(wicketId, audioUrl, width, 20);
      player.setShowDownloadLink(false);
      player.setRenderBodyOnly(true);

      String preview = elt.getAttribute("poster");
      if (!Strings.isEmpty(preview))
        player.setPreview(getRelativeRef(preview));
     
      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()));
View Full Code Here

      private static final long serialVersionUID = 1L;

      @Override
      public Component getIconFor(ISIXmlSection section) {
        return new Image("icon").setVisible(false);
      }
View Full Code Here

    catch (NullPointerException e)
    {
      // Ignore
    }
    add(new EnhancedPageView("page", (Page)page));
    add(new Image("bug", new PackageResourceReference(InspectorPage.class, "bug.png")));
    add(new BookmarkablePageLink<>("allsessions", LiveSessionsPage.class));
    add(new Label("wicketVersion", getApplication().getFrameworkSettings().getVersion()));
  }
View Full Code Here

    {
      link.add(new WebMarkupContainer("img").setVisibilityAllowed(false));
    }
    else
    {
      link.add(new Image("img", img));
    }
    link.add(new Label("data", getDataModel()));
  }
View Full Code Here

      {
        return "wicketDebugBar" + (DebugBar.this.hasErrorMessage() ? "Error" : "");
      }
    }));

    add(new Image("logo", new PackageResourceReference(DebugBar.class, "wicket.png")));
   
    add(contentSection("content", initiallyExpanded));
  }
View Full Code Here

          item.add(comp);
        }
      }
    });

    section.add(new Image("removeImg", new PackageResourceReference(DebugBar.class, "remove.png")));

    return section;
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.image.Image

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.