Examples of IWidget


Examples of org.apache.wookie.beans.IWidget

    String cloneSharedDataKey = request.getParameter("cloneshareddatakey");
    if (sharedDataKey == null || sharedDataKey.trim().equals("") || cloneSharedDataKey == null || cloneSharedDataKey.trim().equals("")){//$NON-NLS-1$ //$NON-NLS-2$
      throw new InvalidParametersException();
    }
    String cloneKey = SharedDataHelper.getInternalSharedDataKey(instance, cloneSharedDataKey);
        IWidget widget = instance.getWidget();
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    for (ISharedData sharedData : new SharedContext(instance).getSharedData())
    {
        ISharedData clone = persistenceManager.newInstance(ISharedData.class);
            clone.setDkey(sharedData.getDkey());
View Full Code Here

Examples of org.apache.wookie.beans.IWidget

   * @param locale the locale of the widget instance
   * @return an XML representation of the Widget Instance as a String
   */
  public static String createXMLWidgetInstanceDocument(IWidgetInstance instance, String url, String locale){
    String xml = XMLDECLARATION;
    IWidget widget = instance.getWidget();
   
    // Return a default width and height where the original value is either not provided
    // or of an invalid range (<0)
    String width = String.valueOf(IW3CXMLConfiguration.DEFAULT_WIDTH_LARGE);
    String height = String.valueOf(IW3CXMLConfiguration.DEFAULT_HEIGHT_LARGE);
    if (widget.getWidth()!=null && widget.getWidth()>0) width = widget.getWidth().toString();
    if (widget.getHeight()!=null && widget.getHeight()>0) height = widget.getHeight().toString();
       
    xml += "<widgetdata>"; //$NON-NLS-1$
    xml += "\t<url>"+url+"</url>"; //$NON-NLS-1$ //$NON-NLS-2$
    xml += "\t<identifier>"+instance.getIdKey()+"</identifier>\n"; //$NON-NLS-1$ //$NON-NLS-2$
    xml += "\t<title>"+StringEscapeUtils.escapeXml(widget.getWidgetTitle(locale))+"</title>\n"; //$NON-NLS-1$ //$NON-NLS-2$
    xml += "\t<height>"+height+"</height>\n"; //$NON-NLS-1$ //$NON-NLS-2$
    xml += "\t<width>"+width+"</width>\n"; //$NON-NLS-1$ //$NON-NLS-2$
    xml += "</widgetdata>"; //$NON-NLS-1$
   
    return xml;
View Full Code Here

Examples of org.apache.wookie.beans.IWidget

   
    return xml;
  }
 
  public static String toJson(IWidgetInstance instance, String url, String locale) {
    IWidget widget = instance.getWidget();
    String width = String.valueOf(IW3CXMLConfiguration.DEFAULT_WIDTH_LARGE);
    String height = String.valueOf(IW3CXMLConfiguration.DEFAULT_HEIGHT_LARGE);
    if (widget.getWidth() != null && widget.getWidth() > 0)
      width = widget.getWidth().toString();
    if (widget.getHeight() != null && widget.getHeight() > 0)
      height = widget.getHeight().toString();
    JSONObject json = new JSONObject();
    try {
      json.put("url", url);
      json.put("identifier", instance.getIdKey());
      json.put("title", widget.getWidgetTitle(locale));
      json.put("height", height);
      json.put("width", width);
    } catch (JSONException e) {
      logger.error("Problem rendering instance using JSON",e);
    }
View Full Code Here

Examples of org.apache.wookie.beans.IWidget

   * @param widgetId
   * @return a new WidgetInstance, or null if the instance cannot be created
   */
  public IWidgetInstance newInstance(String apiKey, String userId, String sharedDataKey, String serviceType, String widgetId, String lang){
    try {
      IWidget widget = null;
      IWidgetInstance widgetInstance;
      // Widget ID or Widget Type?
          IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
      if (widgetId != null){
        widget = persistenceManager.findWidgetByGuid(widgetId);
View Full Code Here

Examples of org.apache.wookie.beans.IWidget

      HttpServletResponse response) throws ResourceNotFoundException,
      UnauthorizedAccessException, IOException {
    // attempt to get specific widget by id; note that this is the internal
    // widget integer ID and not the widget URI
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidget widget = persistenceManager.findById(IWidget.class, resourceId);
    if (widget == null) throw new ResourceNotFoundException();
    // redirect to the UDD
    if (widget.getUpdateLocation() ==  null) throw new ResourceNotFoundException();
    response.sendRedirect(widget.getUpdateLocation());
  }
View Full Code Here

Examples of org.apache.wookie.beans.IWidget

    if (localized == null) {

      //
      // Get the Widget this resource request is related to
      //
      IWidget widget = getWidgetFromRequest(request);

      //
      // Only if we have a valid instance and a resource which has no
      // localization parameter do we start the locale algorithm
      //
View Full Code Here

Examples of org.apache.wookie.beans.IWidget

  protected void update(String resourceId, HttpServletRequest request, HttpServletResponse response)
      throws ResourceNotFoundException, InvalidParametersException,
      UnauthorizedAccessException {
      // attempt to get specific widget by id
      IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
      IWidget widget = persistenceManager.findById(IWidget.class, resourceId);
      if (widget == null) throw new ResourceNotFoundException();
      // FIXME localize error messages
      try {
        W3CWidgetFactory factory  = getFactory(request.getSession().getServletContext());
        installUpdate(factory, widget, false);
View Full Code Here

Examples of org.apache.wookie.beans.IWidget

    if(widgetInstance==null) return map;
   
    // Get i18n-enabled metadata for the Widget's locale and encode it using unicode control characters.
   
    String locales[] = {widgetInstance.getLang()};
    IWidget widget = widgetInstance.getWidget();
     
    String author = "";
        String email = "";
        String href = "";
    if (widget.getAuthor() != null){
            if (widget.getAuthor().getAuthor() != null) author = WidgetFormattingUtils.getEncoded(widget.getAuthor().getDir(), widget.getAuthor().getAuthor());
          if (widget.getAuthor().getEmail() != null) email = widget.getAuthor().getEmail();
          if (widget.getAuthor().getHref() != null) href = widget.getAuthor().getHref();
    }

    String name = "";
    IName iname = (IName)LocalizationUtils.getLocalizedElement(widget.getNames().toArray(new IName[widget.getNames().size()]), locales, widget.getDefaultLocale());
    if (iname != null && iname.getName() != null) name = WidgetFormattingUtils.getEncoded(iname.getDir(), iname.getName());
    String shortName = "";
    if (iname != null && iname.getShortName() != null) shortName = WidgetFormattingUtils.getEncoded(iname.getDir(), iname.getShortName());
   
    String description = "";
    IDescription idescription = (IDescription)LocalizationUtils.getLocalizedElement(widget.getDescriptions().toArray(new IDescription[widget.getDescriptions().size()]), locales, widget.getDefaultLocale());
    if (idescription != null && idescription.getContent() != null) description = WidgetFormattingUtils.getEncoded(idescription.getDir(), idescription.getContent());
   
    String version = "";
    if (widget.getVersion() != null) version = WidgetFormattingUtils.getEncoded(widget.getDir(), widget.getVersion());
   
    String width = "0";
    if (widget.getWidth() != null) width = String.valueOf(widget.getWidth());
   
    String height = "0";
    if (widget.getHeight() != null) height = String.valueOf(widget.getHeight());
   
    // Add in metadata

    map.put("id", String.valueOf(widget.getGuid()))//$NON-NLS-1$
    map.put("author", author)//$NON-NLS-1$
    map.put("authorEmail", email);//$NON-NLS-1$
    map.put("authorHref", href);//$NON-NLS-1$
    map.put("name", name);//$NON-NLS-1$
    map.put("description", description);//$NON-NLS-1$ 
View Full Code Here

Examples of org.apache.wookie.beans.IWidget

   * @param grantAccessRequests whether to grant access requests created for the widget
   * @return the widget
   */
  public static IWidget addNewWidget(W3CWidget model, String[] widgetTypes, boolean grantAccessRequests) {
      IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidget widget = createWidget(persistenceManager, model);
    createTypes(persistenceManager, widgetTypes, widget);
    createStartFiles(persistenceManager, model,widget);
    createNames(persistenceManager, model,widget);
    createDescriptions(persistenceManager, model,widget);
    createIcons(persistenceManager, model, widget);
View Full Code Here

Examples of org.eclipse.jface.menus.IWidget

     * @see org.eclipse.ui.internal.WindowTrimProxy#dock(int)
     */
    public void dock(int newSide) {
      // out with the old...
      for (Iterator iter = widgets.iterator(); iter.hasNext();) {
        IWidget widget = (IWidget) iter.next();
        widget.dispose();
       
        cacheEntry.removeWidget(widget);
      }

      // ...in with the new
      for (Iterator iter = widgets.iterator(); iter.hasNext();) {
        IWorkbenchWidget widget = (IWorkbenchWidget) iter.next();
        if (widget instanceof AbstractWorkbenchTrimWidget)
          ((AbstractWorkbenchTrimWidget)widget).fill(parent, curSide, newSide);
        else
          widget.fill(parent);
      }

      curSide = newSide;
      parent.layout();
    }
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.