[Nextobjects-devel] nextobjects/nextobjects/src/org/devaki/nextobjects/ui/main NOWorkspace.java,1.6,
Status: Alpha
Brought to you by:
eflorent
From: <efl...@us...> - 2003-05-31 13:42:37
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/ui/main In directory sc8-pr-cvs1:/tmp/cvs-serv22383/src/org/devaki/nextobjects/ui/main Modified Files: NOWorkspace.java Log Message: CheckStyle + debug graphics. Index: NOWorkspace.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/ui/main/NOWorkspace.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NOWorkspace.java 24 May 2003 18:50:47 -0000 1.6 --- NOWorkspace.java 31 May 2003 13:42:34 -0000 1.7 *************** *** 45,95 **** */ ! public class NOWorkspace extends JTabbedPane implements MouseListener { ! public NOWorkspace() { ! super(); ! addMouseListener(this); ! } ! public void addPanel(JPanel pJPanel,String title) ! { ! this.add(pJPanel,title); ! } ! public void addTab(String title, Component component) { ! this.addTab(title, component, null); ! } ! ! public void addTab(String title, Component component, Icon extraIcon) { ! super.addTab(title, new CloseTabIcon(extraIcon), component); ! } ! public void mouseClicked(MouseEvent e) { ! int tabNumber=getUI().tabForCoordinate(this, e.getX(), e.getY()); ! ModelMan.setCurrentObject(null); ! if (tabNumber < 0) return; ! ModelMan.setCurrentModel((BaseModel)ModelMan.getModels() ! .elementAt(tabNumber)); ! Rectangle rect=((CloseTabIcon)getIconAt(tabNumber)).getBounds(); ! if (rect.contains(e.getX(), e.getY())) ! { ! if (ModelMan.close(ModelMan.getCurrentModel())) ! { ! if (ModelMan.getModels().size()>0) ! { ! ModelMan.setCurrentModel((BaseModel)ModelMan.getModels() ! .elementAt(this.getSelectedIndex())); ! } ! } ! } ! NOMenuBar.fixFileMenu(); ! NOMenuBar.fixEditMenu(); ! NOToolBar1.fixIcons(); ! NOToolBar2.fixIcons(); ! } ! public void mouseEntered(MouseEvent e) {} ! public void mouseExited(MouseEvent e) {} ! public void mousePressed(MouseEvent e) {} ! public void mouseReleased(MouseEvent e) {} } --- 45,152 ---- */ ! public class NOWorkspace extends JTabbedPane implements MouseListener ! { ! /** ! * constructor ! */ ! public NOWorkspace() ! { ! super(); ! addMouseListener(this); ! } ! /** ! * Add a panel ! * @param pJPanel the panel ! * @param title the title ! */ ! public void addPanel(JPanel pJPanel, String title) ! { ! this.add(pJPanel, title); ! } ! /** ! * add a tabbed pane ! * @param component the component ! * @param title the title ! */ ! public void addTab(String title, Component component) ! { ! this.addTab(title, component, null); ! } ! /** ! * add a tabbed pane ! * @param title title ! * @param component component ! * @param extraIcon icon ! */ ! public void addTab(String title, Component component, Icon extraIcon) ! { ! super.addTab(title, new CloseTabIcon(extraIcon), component); ! } ! /** ! * What to di when mouse clicked ! * @param e <code>MouseEvent</code> ! */ ! public void mouseClicked(MouseEvent e) ! { ! int tabNumber = getUI().tabForCoordinate(this, e.getX(), e.getY()); ! ModelMan.setCurrentObject(null); ! if (tabNumber < 0) ! return; ! ModelMan.setCurrentModel( ! (BaseModel) ModelMan.getModels().elementAt(tabNumber)); ! Rectangle rect = ((CloseTabIcon) getIconAt(tabNumber)).getBounds(); ! if (rect.contains(e.getX(), e.getY())) ! { ! if (ModelMan.close(ModelMan.getCurrentModel())) ! { ! if (ModelMan.getModels().size() > 0) ! { ! ModelMan.setCurrentModel( ! (BaseModel) ModelMan.getModels().elementAt( ! this.getSelectedIndex())); ! } ! } ! } ! NOMenuBar.fixFileMenu(); ! NOMenuBar.fixEditMenu(); ! NOToolBar1.fixIcons(); ! NOToolBar2.fixIcons(); ! } ! /** ! * What to di when mouse entered ! * actually do nothing ! * @param e <code>MouseEvent</code> ! */ ! public void mouseEntered(MouseEvent e) ! { ! } ! /** ! * What to di when mouse exited ! * actually do nothing ! * @param e <code>MouseEvent</code> ! */ ! public void mouseExited(MouseEvent e) ! { ! } ! /** ! * What to di when mouse pressed ! * actually do nothing ! * @param e <code>MouseEvent</code> ! */ ! public void mousePressed(MouseEvent e) ! { ! } ! /** ! * What to di when mouse released ! * actually do nothing ! * @param e <code>MouseEvent</code> ! */ ! public void mouseReleased(MouseEvent e) ! { ! } } *************** *** 99,152 **** * like in JBuilder. This value is null if no extra icon is required. */ ! class CloseTabIcon implements Icon { ! private int x_pos; ! private int y_pos; ! private int width; ! private int height; ! private Icon fileIcon; ! public CloseTabIcon(Icon fileIcon) { ! this.fileIcon=fileIcon; ! width=16; ! height=16; ! } ! public void paintIcon(Component c, Graphics g, int x, int y) { ! this.x_pos=x; ! this.y_pos=y; ! Color col=g.getColor(); ! g.setColor(Color.black); ! int y_p=y+2; ! g.drawLine(x+1, y_p, x+12, y_p); ! g.drawLine(x+1, y_p+13, x+12, y_p+13); ! g.drawLine(x, y_p+1, x, y_p+12); ! g.drawLine(x+13, y_p+1, x+13, y_p+12); ! g.drawLine(x+3, y_p+3, x+10, y_p+10); ! g.drawLine(x+3, y_p+4, x+9, y_p+10); ! g.drawLine(x+4, y_p+3, x+10, y_p+9); ! g.drawLine(x+10, y_p+3, x+3, y_p+10); ! g.drawLine(x+10, y_p+4, x+4, y_p+10); ! g.drawLine(x+9, y_p+3, x+3, y_p+9); ! g.setColor(col); ! if (fileIcon != null) { ! fileIcon.paintIcon(c, g, x+width, y_p); ! } ! } ! public int getIconWidth() { ! return width + (fileIcon != null? fileIcon.getIconWidth() : 0); ! } ! public int getIconHeight() { ! return height; ! } ! public Rectangle getBounds() { ! return new Rectangle(x_pos, y_pos, width, height); ! } } - - - --- 156,251 ---- * like in JBuilder. This value is null if no extra icon is required. */ ! class CloseTabIcon implements Icon ! { ! /** ! * X position ! */ ! private int x_pos; ! /** ! * Y position ! */ ! private int y_pos; ! /** ! * Width ! */ ! private int width; ! /** ! * Height ! */ ! private int height; ! /** ! * Icon ! */ ! private Icon fileIcon; ! /** ! * CloseTabIcon ! * @param fileIcon the file icon ! */ ! public CloseTabIcon(Icon fileIcon) ! { ! this.fileIcon = fileIcon; ! width = 16; ! height = 16; ! } ! /** ! * Paint icon ! * @param c component ! * @param g graphics g ! * @param x x ! * @param y y ! */ ! public void paintIcon(Component c, Graphics g, int x, int y) ! { ! this.x_pos = x; ! this.y_pos = y; ! Color col = g.getColor(); ! g.setColor(Color.black); ! int y_p = y + 2; ! g.drawLine(x + 1, y_p, x + 12, y_p); ! g.drawLine(x + 1, y_p + 13, x + 12, y_p + 13); ! g.drawLine(x, y_p + 1, x, y_p + 12); ! g.drawLine(x + 13, y_p + 1, x + 13, y_p + 12); ! g.drawLine(x + 3, y_p + 3, x + 10, y_p + 10); ! g.drawLine(x + 3, y_p + 4, x + 9, y_p + 10); ! g.drawLine(x + 4, y_p + 3, x + 10, y_p + 9); ! g.drawLine(x + 10, y_p + 3, x + 3, y_p + 10); ! g.drawLine(x + 10, y_p + 4, x + 4, y_p + 10); ! g.drawLine(x + 9, y_p + 3, x + 3, y_p + 9); ! g.setColor(col); ! if (fileIcon != null) ! { ! fileIcon.paintIcon(c, g, x + width, y_p); ! } ! } ! /** ! * get the icon width ! * @return the width ! */ ! public int getIconWidth() ! { ! return width + (fileIcon != null ? fileIcon.getIconWidth() : 0); ! } ! /** ! * get icon height ! * @return height ! */ ! public int getIconHeight() ! { ! return height; ! } ! /** ! * get the boundaries ! * @return bounds ! */ ! public Rectangle getBounds() ! { ! return new Rectangle(x_pos, y_pos, width, height); ! } } |