@Override
  protected void printBlock(StringBuffer result, int firstEventMarker, Block block) {
    AbstractRaplaBlock raplaBlock = (AbstractRaplaBlock) block;
    // get Appointment for ID
    AppointmentImpl curAppointment = ((AppointmentImpl) raplaBlock.getAppointment());

    // Remove the org.rapla we don't need them for GET-Parameter
    String appointmendId =
        ((RefEntity<?>) curAppointment)
            .getId()
            .toString()
            .replace("org.rapla.entities.domain.Appointment", "");
    String reservationId =
        ((RefEntity<?>) (curAppointment.getReservation()))
            .getId()
            .toString()
            .replace("org.rapla.entities.domain.Reservation_", "");

    RaplaContext raplaContext = raplaBlock.getBuildContext().getServiceManager();
    String curUrl;
    try {
      curUrl = raplaContext.lookup(HTMLMobileWeekViewPage.URL_KEY);
    } catch (RaplaContextException e) {
      throw new IllegalStateException(e.getMessage());
    }
    // result.append("<div class=\"event_block\"" + firstEventMarker + ">");
    String blockDetailUrl = curUrl + "&amp;detail=" + reservationId + appointmendId;
    result.append("<a href=\"" + blockDetailUrl + "\">");
    result.append(block.toString());
    result.append("</a>\n");
    // result.append("</td>");

    // build ID-String for detail view. Example string: detail=RESERVATIONID_APPOINTMENTID
  }
Exemplo n.º 2
0
 private void service(RaplaContext context) throws RaplaException {
   this.context = context;
   i18n = context.lookup(RaplaResources.class);
   RaplaImages images = context.lookup(RaplaImages.class);
   if (useDefaultOptions) {
     if (buttons.length > 1) {
       getButton(0).setText(i18n.getString("ok"));
       getButton(1).setIcon(images.getIconFromKey("icon.abort"));
       getButton(1).setText(i18n.getString("abort"));
     } else {
       getButton(0).setText(i18n.getString("ok"));
     }
   }
   localeSelector = (ServerBundleManager) context.lookup(BundleManager.class);
   localeSelector.addLocaleChangeListener(this);
   frameList = context.lookup(FrameControllerList.class);
   frameList.add(this);
 }
Exemplo n.º 3
0
 @SuppressWarnings("unchecked")
 public void init(RaplaContext context) {
   this.context = context;
   try {
     setRenderer(new NamedListCellRenderer(context.lookup(RaplaLocale.class).getLocale()));
   } catch (RaplaContextException e) {
     throw new IllegalStateException(e);
   }
 }
Exemplo n.º 4
0
  /**
   * @throws RaplaException when the resource-file is missing or can't be accessed or can't be
   *     parsed
   */
  public I18nBundleImpl(RaplaContext context, Configuration config, Logger logger)
      throws RaplaException {
    enableLogging(logger);
    Locale locale;
    try {
      m_localeSelector = (LocaleSelectorImpl) context.lookup(LocaleSelector.class);
    } catch (RaplaContextException ex) {
    }
    if (m_localeSelector != null) {
      m_localeSelector.addLocaleChangeListenerFirst(this);
      locale = m_localeSelector.getLocale();

    } else {
      locale = Locale.getDefault();
    }
    String filePath = config.getChild("file").getValue(null);
    try {
      InputStream resource;
      if (filePath == null) {
        className = config.getChild("classname").getValue(null);
        if (className == null) {
          className = config.getAttribute("id");
        } else {
          className = className.trim();
        }
        String resourceFile = "" + className.replaceAll("\\.", "/") + ".xml";
        resource = getClass().getClassLoader().getResourceAsStream(resourceFile);
        dictionaryFile = resource != null ? resourceFile : null;
      } else {
        File file = new File(filePath);
        getLogger().info("getting lanaguageResources  from " + file.getCanonicalPath());
        resource = new FileInputStream(file);
        dictionaryFile = filePath;
      }
      if (resource != null) {
        dict = new TranslationParser().parse(resource);
        resource.close();
      } else {
        dict = new RaplaDictionary(locale.getLanguage());
      }
    } catch (Exception ex) {
      throw new RaplaException(ex);
    }
    setLocale(locale);
    try {
      parentId = getPack(locale).getString(TranslationParser.PARENT_BUNDLE_IDENTIFIER);
    } catch (MissingResourceException ex) {
    }
  }