⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editte.java

📁 一个虚拟训练系统.主要使用j2ee框架实现.
💻 JAVA
字号:
package com.jsfcompref.trainer.backing;
import com.jsfcompref.trainer.TrainingEvent;
import com.jsfcompref.trainer.TrainingEventRegistry;
import com.jsfcompref.trainer.util.JSFUtil;

import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.component.UIData;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import javax.faces.event.ActionEvent;

public class EditTe 
{
  public EditTe()
  {
  }
  
  private UIData data = null;
  
    public String saveTEAction()
     {
       FacesContext ctx = FacesContext.getCurrentInstance();
       Application app = ctx.getApplication();
       
       //Grab edited TrainingEvent and store locally as "te"
       TrainingEvent te = (TrainingEvent)JSFUtil.getManagedObject("EditTrainingEvent");
             
       // Grab TrainingEventRegistry  - store in "eventRegistry"
       TrainingEventRegistry eventRegistry = (TrainingEventRegistry) JSFUtil.getManagedObject("TrainingEventRegistry");
       
       // Call TE registry method to update registry with edited training event.
       eventRegistry.updateTrainingEvent(te);
       return null;
     }

// Scroller methods below
     
  /**
   * Handles the ActionEvent generated as a result of clicking on a
   * link that points a particular page in the result-set.
   */
  public void processScrollEvent(ActionEvent event) {
      int currentRow = 1;
     
  //     FacesContext context = FacesContext.getCurrentInstance();
      UIComponent component = event.getComponent();
      Integer curRow = (Integer) component.getAttributes().get("currentRow");
      if (curRow != null) {
          currentRow = curRow.intValue();
      }
      // scroll to the appropriate page in the ResultSet.
      scroll(currentRow);
  }
 
  /**
   * <p>Scroll to the page that contains the specified row number.</p>
   *
   * @param row Desired row number
   */
  public void scroll(int row) {

      int rows = data.getRows();
      if (rows < 1) {
          return; // Showing entire table already
      }
      if (row < 0) {
          data.setFirst(0);
      } else if (row >= data.getRowCount()) {
          data.setFirst(data.getRowCount() - 1);
      } else {
          data.setFirst(row - (row % rows));
      }

  }


  public void setData(UIData data) {
    this.data = data;
  }

  public UIData getData() {
    return data;
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -