Esempio n. 1
0
 /**
  * We don't want some things recalled in preferences (e.g. tree sorting) as they aren't the same
  * for all choose data. Ensure we put out desired values in first.
  */
 private void overridePrefs() {
   UIPropertyContext baseContext = UIPropertyContext.createContext("tablePrefs");
   PropertyContext context =
       baseContext.createChildContext(treeViewModel.getDataView().getPrefsKey());
   final String VIEW_INDEX_PREFS_KEY = "viewIdx";
   context.setInt(VIEW_INDEX_PREFS_KEY, treeViewModel.getDefaultTreeViewIndex());
 }
Esempio n. 2
0
  /** Remove any temporary xml files produced while outputting characters. */
  static void removeTemporaryFiles() {
    final boolean cleanUp =
        UIPropertyContext.getInstance().initBoolean(UIPropertyContext.CLEANUP_TEMP_FILES, true);

    if (!cleanUp) {
      return;
    }

    final String aDirectory = SettingsHandler.getTempPath() + File.separator;
    new File(aDirectory)
        .list(
            new FilenameFilter() {
              @Override
              public boolean accept(File aFile, String aString) {
                try {
                  if (aString.startsWith(Constants.TEMPORARY_FILE_NAME)) {
                    final File tf = new File(aFile, aString);
                    tf.delete();
                  }
                } catch (Exception e) {
                  Logging.errorPrint("removeTemporaryFiles", e);
                }

                return false;
              }
            });
  }
Esempio n. 3
0
  @Override
  public void setVisible(boolean b) {
    //
    // Only do this if 1 entry and can add...
    //
    ListFacade<InfoFacade> availableList = chooser.getAvailableList();
    if ((availableList != null)
        && (availableList.getSize() == 1)
        && (listModel.getSize() == 0)
        && b
        && !chooser.isUserInput()) {
      final int method = UIPropertyContext.getSingleChoiceAction();

      if (method != Constants.CHOOSER_SINGLE_CHOICE_METHOD_NONE) {
        chooser.addSelected(availableList.getElementAt(0));

        if (method == Constants.CHOOSER_SINGLE_CHOICE_METHOD_SELECT_EXIT) {
          chooser.commit();
          committed = true;
          return;
        }
      }
    }

    super.setVisible(b);
  }