View Javadoc

1   //--------------------------------------
2   //
3   // FontMetric.java
4   // Since: 2009/07/15
5   //
6   //--------------------------------------
7   package org.utgenome.gwt.utgb.server.app;
8   
9   import java.awt.Font;
10  import java.io.IOException;
11  
12  import javax.servlet.ServletException;
13  import javax.servlet.http.HttpServletRequest;
14  import javax.servlet.http.HttpServletResponse;
15  
16  import org.utgenome.gwt.utgb.server.WebTrackBase;
17  import org.utgenome.gwt.utgb.server.app.FontPanel.FontInfo;
18  import org.xerial.lens.JSONLens;
19  import org.xerial.util.Pair;
20  import org.xerial.util.log.Logger;
21  
22  /**
23   * Request handler
24   * 
25   */
26  public class FontMetric extends WebTrackBase {
27  	private static final long serialVersionUID = 1L;
28  	private static Logger _logger = Logger.getLogger(FontMetric.class);
29  
30  	public FontMetric() {
31  	}
32  
33  	public int fontSize = 10;
34  
35  	@Override
36  	public void handle(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
37  
38  		Pair<FontInfo, Font> fontInfo = FontPanel.getFontInfo(fontSize);
39  		response.getWriter().println(JSONLens.toJSON(fontInfo.getFirst()));
40  
41  	}
42  
43  }