public String[] getTags() {
   String[] tags = new String[CURSOR_TYPES.size()];
   int i = 0;
   for (java.util.Iterator iter = CURSOR_TYPES.keySet().iterator(); iter.hasNext(); i++)
     tags[i] = (String) iter.next();
   return tags;
 }
 /**
  * Sets the accelerator sequence
  *
  * @param accSeq The new accelSeq value
  */
 public void setAccelSeq(AcceleratorSeq accSeq) {
   java.util.List<AcceleratorNode> accNodes = accSeq.getNodesOfType(Electromagnet.s_strType);
   java.util.Iterator<AcceleratorNode> itr = accNodes.iterator();
   while (itr.hasNext()) {
     Electromagnet emg = (Electromagnet) itr.next();
     if (emg.getStatus()) {
       emg.setUseFieldReadback(false);
     }
   }
   ringFoilPosCorr.setAccelSeq(accSeq);
 }
  /**
   * Checks all the Bean preference editor panels to determine if they are in a state that allows
   * any changes to be committed.
   */
  private boolean canCommit() {
    java.util.Iterator i = mPrefsBeans.iterator();
    boolean can_commit = true;

    while (i.hasNext()) {
      if (!((BeanPreferences) i.next()).canCommit()) {
        can_commit = false;
        break;
      }
    }

    return can_commit;
  }
  /** Commits changes on all known Bean preference editors. */
  private void commit() {
    java.util.Iterator i = mPrefsBeans.iterator();

    while (i.hasNext()) {
      BeanPreferences bean = (BeanPreferences) i.next();

      try {
        bean.save();
      } catch (java.io.IOException io_ex) {
        JOptionPane.showMessageDialog(
            null,
            "Could not save preferences for " + bean.getEditorName() + ": " + io_ex.getMessage(),
            "I/O Exception on Save",
            JOptionPane.ERROR_MESSAGE);
      }
    }
  }
Beispiel #5
0
  /**
   * 当前的报表运行环境切换到env
   *
   * @param env 需要切换去的环境
   */
  public static void switchToEnv(Env env) {
    if (env == null) {
      return;
    }

    Env oldEnv = FRContext.getCurrentEnv();
    String oldEnvPath = oldEnv == null ? null : oldEnv.getPath();

    // 看一下这个env在DesignerEnvManager里面有没有对应的,有的话就setCurrentEnvName
    DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
    java.util.Iterator<String> nameIt = envManager.getEnvNameIterator();
    while (nameIt.hasNext()) {
      String name = nameIt.next();
      if (ComparatorUtils.equals(envManager.getEnv(name), env)) {
        envManager.setCurEnvName(name);
        break;
      }
    }

    // 更新CurrentEnv于FRContext & DesignerEnvManager
    FRContext.setCurrentEnv(env);

    final Env run_env = env;

    // 刷新DesignerFrame里面的面板
    SwingUtilities.invokeLater(
        new Runnable() {

          public void run() {
            if (DesignerContext.getDesignerFrame() == null) {
              return;
            }
            DesignerContext.getDesignerFrame().refreshEnv(run_env);
            DesignerContext.getDesignerFrame().repaint(); // kunsnat: 切换环境后 刷新下 报表. 比如图表某些风格改变.
          }
        });
    // 当换了运行环境,重置服务器,让它下次预览时重启
    if (env instanceof LocalEnv && !ComparatorUtils.equals(env.getPath(), oldEnvPath)) {
      StartServer.currentEnvChanged();
    }
  }