Examples of Preferences


Examples of org.olat.core.util.prefs.Preferences

   * Store the sortingCriteria for the current portlet. Auto sorting was choosed.
   * @param ureq
   * @param sortingCriteria
   */
  protected void saveSortingConfiguration(UserRequest ureq, SortingCriteria sortingCriteria) {   
    Preferences guiPreferences = ureq.getUserSession().getGuiPreferences();
    guiPreferences.putAndSave(Map.class, getPreferenceKey(SORTING_CRITERIA_PREF), sortingCriteria.getPersistable());
    if(sortingCriteria.getSortingType()==SortingCriteria.AUTO_SORTING) {
      Map<Long, Integer> storedPrefs = (Map<Long, Integer>) guiPreferences.get(Map.class, getPreferenceKey(this.SORTED_ITEMS_PREF));
      if (storedPrefs != null) {
        //if auto sorting choosed, remove any manually sorting info
        List sortedItems = new ArrayList();
        guiPreferences.putAndSave(Map.class, getPreferenceKey(SORTED_ITEMS_PREF),getSortedItemsMap(sortedItems));
      }
    }
  }
View Full Code Here

Examples of org.olat.core.util.prefs.Preferences

   * @return the persistent sortingCriteria if any found, else a default sortingCriteria.
   */
  protected SortingCriteria getPersistentSortingConfiguration(UserRequest ureq) {
    SortingCriteria returnSortingCriteria = null;

    Preferences guiPreferences = ureq.getUserSession().getGuiPreferences();
    Object storedPrefs = guiPreferences.get(Map.class, getPreferenceKey(SORTING_CRITERIA_PREF));
   
    if (storedPrefs != null) {     
      returnSortingCriteria = new SortingCriteria((Map<String, Integer>) storedPrefs, this.sortingTermsList);
    } else {
      returnSortingCriteria = new SortingCriteria(this.sortingTermsList);
View Full Code Here

Examples of org.olat.core.util.prefs.Preferences

   * Stores the manually sorted items.
   * @param ureq
   * @param sortedItems
   */
  protected void saveManuallySortedItems(UserRequest ureq, List<PortletEntry> sortedItems) {
    Preferences guiPreferences = ureq.getUserSession().getGuiPreferences();
    //store manual sorting type
    SortingCriteria manualSortingCriteria = new SortingCriteria();
    guiPreferences.putAndSave(Map.class, getPreferenceKey(SORTING_CRITERIA_PREF), manualSortingCriteria.getPersistable())
    //store the sorted items
    guiPreferences.putAndSave(Map.class, getPreferenceKey(SORTED_ITEMS_PREF), getSortedItemsMap(sortedItems));
  }
View Full Code Here

Examples of org.olat.core.util.prefs.Preferences

   * @deprecated - use the CommentAndRatingService instead. Still here in case we want to migrate the ratings
   */
  @Deprecated
  public void storePageRating(final UserRequest ureq, final Locale locale, final String bundleName, final String page, final float rating) {
    final String key = calculateCombinedKey(locale, bundleName, page);
    final Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
    // 1) Update community rating
    CoordinatorManager.getCoordinator().getSyncer().doInSync(contextHelpRatingEventBus,new SyncerExecutor(){
      public void execute() {
        Object[] statsValues = contextHelpRatings.get(key);
        if (statsValues == null) {
          // create new data object for this page
          statsValues = new Object[2];
          statsValues[0] = new Double(rating);
          statsValues[1] = new Integer(1);
        } else {
          Float lastRating = (Float) guiPrefs.get(ContextHelpModule.class, GUI_PREFS_PREFIX + key);
          // update data object for this page
          Double cummulatedRatings = (Double) statsValues[0];
          double newValue = cummulatedRatings.doubleValue() + rating - (lastRating == null ? 0 : lastRating.doubleValue());
          statsValues[0] = new Double(newValue > 0 ? newValue : 0);
          Integer numberOfRatings = (Integer) statsValues[1];     
          int newRatingCount = numberOfRatings.intValue() + (lastRating == null ? 1 : 0);
          statsValues[1] = new Integer(newRatingCount);
        }
        // notify everybody about this change (including ourselfs) to update  local context help ratings
        ContextHelpRatingEvent ratingEvent = new ContextHelpRatingEvent(key, statsValues);
        CoordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(ratingEvent, contextHelpRatingEventBus);
        // now save in filesystem
        XStreamHelper.writeObject(contextHelpRatingFile, contextHelpRatings);
      }
    });   
    // 2) Update user rating
    guiPrefs.putAndSave(ContextHelpModule.class, GUI_PREFS_PREFIX + key, new Float(rating));
  }
View Full Code Here

Examples of org.olat.core.util.prefs.Preferences

   * @deprecated - use the CommentAndRatingService instead. Still here in case we want to migrate the ratings
   */
  @Deprecated
  public float getPersonalPageRanking(UserRequest ureq, Locale locale, String bundleName, String page) {
    String key = calculateCombinedKey(locale, bundleName, page);
    Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
    Float lastRating = (Float) guiPrefs.get(ContextHelpModule.class, GUI_PREFS_PREFIX + key);
    if (lastRating == null) return 0;
    return lastRating.floatValue();
  }
View Full Code Here

Examples of org.openstreetmap.josm.data.Preferences

    private void readPreferencesFromXML() {
        File[] files = askUserForCustomSettingsFiles(false, tr("Open JOSM customization file"));
        if (files.length == 0) return;

        Preferences tmpPrefs = CustomConfigurator.clonePreferences(Main.pref);

        StringBuilder log = new StringBuilder();
        log.append("<html>");
        for (File f : files) {
            CustomConfigurator.readXML(f, tmpPrefs);
View Full Code Here

Examples of org.osgi.service.prefs.Preferences

    Assert.isTrue(key.contains(NODE_SEPARATOR), "Invalid Eclipse Preferences Key!"); //$NON-NLS-1$

    String nodePath = getNodePath(key);
    key = key.substring(key.lastIndexOf(NODE_SEPARATOR) + 1);

    Preferences prefNode = fRootNode.node(nodePath);
    prefNode.putInt(key, value);
  }
View Full Code Here

Examples of org.osgi.service.prefs.Preferences

    Assert.isTrue(key.contains(NODE_SEPARATOR), "Invalid Eclipse Preferences Key!"); //$NON-NLS-1$

    String nodePath = getNodePath(key);
    key = key.substring(key.lastIndexOf(NODE_SEPARATOR) + 1);

    Preferences prefNode = fRootNode.node(nodePath);
    prefNode.putLong(key, value);
  }
View Full Code Here

Examples of org.osgi.service.prefs.Preferences

    Assert.isTrue(key.contains(NODE_SEPARATOR), "Invalid Eclipse Preferences Key!"); //$NON-NLS-1$

    String nodePath = getNodePath(key);
    key = key.substring(key.lastIndexOf(NODE_SEPARATOR) + 1);

    Preferences prefNode = fRootNode.node(nodePath);
    prefNode.put(key, value);
  }
View Full Code Here

Examples of org.osgi.service.prefs.Preferences

  /**
   * @return the number of editors able to be visible at the same time.
   */
  public static int getOpenEditorLimit() {
    Preferences instanceNode = Platform.getPreferencesService().getRootNode().node("instance");
    if (instanceNode != null) {
      Preferences workbenchNode = instanceNode.node("org.eclipse.ui.workbench");
      if (workbenchNode != null) {
        boolean isLimited = workbenchNode.getBoolean("REUSE_OPEN_EDITORS_BOOLEAN", true);
        if (!isLimited)
          return Integer.MAX_VALUE;

        return workbenchNode.getInt("REUSE_OPEN_EDITORS", 1);
      }
    }

    return 1;
  }
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.