Package org.apache.wicket

Examples of org.apache.wicket.ResourceReference


     * Returns the resource reference to the css for the header contribution, or
     * null if there is no css contribution.
     */
    public ResourceReference getCSS() {
        if (scope != null && cssFilename != null) {
            return new ResourceReference(scope, cssFilename);
        }
       
        return null;
    }
View Full Code Here


     * Returns the resource reference to the javascript for the header contribution, or
     * null if there is no javascript contribution.
     */
    public ResourceReference getJavaScript() {
        if ( scope != null && javaScriptFilename != null ) {
            return new ResourceReference(scope, cssFilename);
        }
       
        return null;
    }
View Full Code Here

     * or null if there is no favicon replacement
     * @return
     */
    public ResourceReference getFavicon() {
        if( scope != null && faviconFilename != null) {
            return new ResourceReference(scope, faviconFilename);
        }
       
        return null;
    }
View Full Code Here

        return link;
    }
   
    Component removeLink(String id, IModel itemModel) {
        final LayerGroupEntry entry = (LayerGroupEntry) itemModel.getObject();
        ImageAjaxLink link = new ImageAjaxLink( id, new ResourceReference( getClass(), "../../img/icons/silk/delete.png") ) {
            @Override
            protected void onClick(AjaxRequestTarget target) {
               
                items.remove( entry );
                target.addComponent( layerTable );
View Full Code Here

        public PositionPanel( String id, LayerGroupEntry entry ) {
            super( id );
            this.entry = entry;
           
            if ( items.indexOf( entry ) > 0 ) {
                ImageAjaxLink upLink = new ImageAjaxLink( "up", new ResourceReference( getClass(), "../../img/icons/silk/arrow_up.png") ) {
                    @Override
                    protected void onClick(AjaxRequestTarget target) {
                        int index = items.indexOf( PositionPanel.this.entry );
                        items.remove( index );
                        items.add( index-1, PositionPanel.this.entry );
                        target.addComponent( layerTable );
                    }
                };
                upLink.getImage().add(new AttributeModifier("alt", true, new ParamResourceModel("up", upLink)));
                add( upLink);
            }
            else {
                ImageAjaxLink blankLink = new ImageAjaxLink( "up", new ResourceReference( getClass(), "../../img/icons/blank.png") ) {
                    @Override
                    protected void onClick(AjaxRequestTarget target) {
                    }
                };
                blankLink.getImage().add(new AttributeModifier("alt", true, new Model("")));
                add(blankLink);
            }
           
            if ( items.indexOf( entry ) < items.size() - 1 ) {
                ImageAjaxLink downLink = new ImageAjaxLink( "down", new ResourceReference( getClass(), "../../img/icons/silk/arrow_down.png") ) {
                    @Override
                    protected void onClick(AjaxRequestTarget target) {
                        int index = items.indexOf( PositionPanel.this.entry );
                        items.remove( index );
                        items.add( index+1, PositionPanel.this.entry );
                        target.addComponent( layerTable );
                    }
                };
                downLink.getImage().add(new AttributeModifier("alt", true, new ParamResourceModel("down", downLink)));
                add( downLink);
            }
            else {
                ImageAjaxLink blankLink = new ImageAjaxLink( "down", new ResourceReference( getClass(), "../../img/icons/blank.png") ) {
                    @Override
                    protected void onClick(AjaxRequestTarget target) {
                       
                    }
                };
View Full Code Here

                    editLink.setEnabled(layer != null);
                    f.add(editLink);
                   
                    return f;
                } else if(property == STATUS) {
                    ResourceReference icon = layerSummary.getStatus().successful() ?
                            icons.getEnabledIcon() : icons.getDisabledIcon();
                    Fragment f = new Fragment(id, "iconFragment", ImportSummaryPage.this);
                    f.add(new Image("icon", icon));
                    return f;
                } else if(property == TYPE) {
                    if(layer != null) {
                        ResourceReference icon = icons.getSpecificLayerIcon(layer);
                        Fragment f = new Fragment(id, "iconFragment", ImportSummaryPage.this);
                        Image image = new Image("icon", icon);
                        image.add(new AttributeModifier("title", true, new Model(getTypeTooltip(layer))));
            f.add(image);
                        return f;
View Full Code Here

     *
     * @param info
     * @return
     */
    public ResourceReference getLayerIcon(LayerInfo info) {
        ResourceReference icon = UNKNOWN_ICON;
        if (info.getType() == Type.VECTOR)
            icon = VECTOR_ICON;
        else if (info.getType() == Type.RASTER)
            icon = RASTER_ICON;
        return icon;
View Full Code Here

        final List<DataStorePanelInfo> infos;
        infos = GeoServerApplication.get().getBeansOfType(DataStorePanelInfo.class);

        for (DataStorePanelInfo panelInfo : infos) {
            if (factoryClass.equals(panelInfo.getFactoryClass())) {
                return new ResourceReference(panelInfo.getIconBase(), panelInfo.getIcon());
            }
        }

        if (DataAccessFactory.class.isAssignableFrom(factoryClass)) {
            // search for the declared default vector store icon
            for (DataStorePanelInfo panelInfo : infos) {
                if ("defaultVector".equals(panelInfo.getId())) {
                    return new ResourceReference(panelInfo.getIconBase(), panelInfo.getIcon());
                }
            }

            // fall back on generic vector icon otherwise
            return new ResourceReference(GeoServerApplication.class,
                    "img/icons/geosilk/database_vector.png");

        } else if (Format.class.isAssignableFrom(factoryClass)) {
            // search for the declared default coverage store icon
            for (DataStorePanelInfo panelInfo : infos) {
                if ("defaultRaster".equals(panelInfo.getId())) {
                    return new ResourceReference(panelInfo.getIconBase(), panelInfo.getIcon());
                }
            }

            // fall back on generic raster icon otherwise
            return new ResourceReference(GeoServerApplication.class,
                    "img/icons/geosilk/page_white_raster.png");
        }
        throw new IllegalArgumentException("Unrecognized store format class: " + factoryClass);
    }
View Full Code Here

    protected FeedbackPanel feedbackPanel;

  @SuppressWarnings("serial")
    public GeoServerBasePage() {
        //add css and javascript header contributions
      ResourceReference faviconReference = null;
        List<HeaderContribution> cssContribs =
            getGeoServerApplication().getBeansOfType(HeaderContribution.class);
        for (HeaderContribution csscontrib : cssContribs) {
            try {
                if (csscontrib.appliesTo(this)) {
                    ResourceReference ref = csscontrib.getCSS();
                    if (ref != null) {
                        add(HeaderContributor.forCss(ref));
                    }
                   
                    ref = csscontrib.getJavaScript();
                    if (ref != null) {
                        add(HeaderContributor.forJavaScript(ref));
                    }
                   
                    ref = csscontrib.getFavicon();
                    if(ref != null) {
                        faviconReference = ref;
                    }
                }
            }
            catch( Throwable t ) {
                LOGGER.log(Level.WARNING, "Problem adding header contribution", t );
            }
        }
       
        // favicon
        if(faviconReference == null) {
            faviconReference = new ResourceReference(GeoServerBasePage.class, "favicon.ico");
        }
        String faviconUrl = RequestCycle.get().urlFor(faviconReference).toString();
        add(new ExternalLink("faviconLink", faviconUrl, null));
     
      // page title
      add(new Label("pageTitle", getPageTitle()));

        // login form
        WebMarkupContainer loginForm = new WebMarkupContainer("loginform");
        add(loginForm);
        final Authentication user = GeoServerSession.get().getAuthentication();
        final boolean anonymous = user == null;
        loginForm.setVisible(anonymous);

        WebMarkupContainer logoutForm = new WebMarkupContainer("logoutform");
        logoutForm.setVisible(user != null);

        add(logoutForm);
        logoutForm.add(new Label("username", anonymous ? "Nobody" : user.getName()));

        // home page link
        add( new BookmarkablePageLink( "home", GeoServerHomePage.class )
            .add( new Label( "label", new StringResourceModel( "home", (Component)null, null ) )  ) );
       
        // dev buttons
        DeveloperToolbar devToolbar = new DeveloperToolbar("devButtons");
        add(devToolbar);
        devToolbar.setVisible(Application.DEVELOPMENT.equalsIgnoreCase(
                getApplication().getConfigurationType()));
       
        final Map<Category,List<MenuPageInfo>> links = splitByCategory(
            filterSecured(getGeoServerApplication().getBeansOfType(MenuPageInfo.class))
        );

        List<MenuPageInfo> standalone = links.containsKey(null)
            ? links.get(null)
            : new ArrayList<MenuPageInfo>();
        links.remove(null);

        List<Category> categories = new ArrayList(links.keySet());
        Collections.sort(categories);

        add(new ListView("category", categories){
            public void populateItem(ListItem item){
                Category category = (Category)item.getModelObject();
                item.add(new Label("category.header", new StringResourceModel(category.getNameKey(), (Component) null, null)));
                item.add(new ListView("category.links", links.get(category)){
                    public void populateItem(ListItem item){
                        MenuPageInfo info = (MenuPageInfo)item.getModelObject();
                        BookmarkablePageLink link = new BookmarkablePageLink("link", info.getComponentClass());
                        link.add(new AttributeModifier("title", true, new StringResourceModel(info.getDescriptionKey(), (Component) null, null)));
                        link.add(new Label("link.label", new StringResourceModel(info.getTitleKey(), (Component) null, null)));
                        Image image;
                        if(info.getIcon() != null) {
                            image = new Image("link.icon", new ResourceReference(info.getComponentClass(), info.getIcon()));
                        } else {
                            image = new Image("link.icon", new ResourceReference(GeoServerBasePage.class, "img/icons/silk/wrench.png"));
                        }
                        image.add(new AttributeModifier("alt", true, new ParamResourceModel(info.getTitleKey(), null)));
                        link.add(image);
                        item.add(link);
                    }
                });
            }
        });

        add(new ListView("standalone", standalone){
                    public void populateItem(ListItem item){
                        MenuPageInfo info = (MenuPageInfo)item.getModelObject();
                        BookmarkablePageLink link = new BookmarkablePageLink("link", info.getComponentClass());
                        link.add(new AttributeModifier("title", true, new StringResourceModel(info.getDescriptionKey(), (Component) null, null)));
                        link.add(new Label("link.label", new StringResourceModel(info.getTitleKey(), (Component) null, null)));
                        item.add(link);
                       
                    }
                }
        );

        add(feedbackPanel = new FeedbackPanel("feedback"));
        feedbackPanel.setOutputMarkupId( true );
       
        // ajax feedback image
        add(new Image("ajaxFeedbackImage",
                new ResourceReference(GeoServerBasePage.class, "img/ajax-loader.gif")));
       
        add(new WebMarkupContainer(HEADER_PANEL));
    }
View Full Code Here

                    return new Label(id, property.getModel(itemModel));
                } else if (property == NewLayerPageProvider.PUBLISHED) {
                    final Resource resource = (Resource) itemModel.getObject();
                    final CatalogIconFactory icons = CatalogIconFactory.get();
                    if(resource.isPublished()) {
                        ResourceReference icon = icons.getEnabledIcon();
                        Fragment f = new Fragment(id, "iconFragment", NewLayerPage.this);
                        f.add(new Image("layerIcon", icon));
                        return f;
                    } else {
                        return new Label(id);
View Full Code Here

TOP

Related Classes of org.apache.wicket.ResourceReference

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.