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

📄 casewindow.java

📁 一个数据挖掘软件ALPHAMINERR的整个过程的JAVA版源代码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
			}
			
			this.dispose();
			((ApplicationWindow) m_ParentFrame).setFocusToFirstWindow(
				isMaximum());
			return true;
		}
		return false;
	}

	/**
	 * Sets modified state of CaseWindow.
	 * @param a_IsModified true if any information of the Case represented by 
	 * this Case Window is modified; false if it is just saved or nothing have been
	 * chagned.
	 */
	public void setModified(boolean a_IsModified) {
		if (m_IsModified == a_IsModified)
			return;

		m_IsModified = a_IsModified;
		if (m_IsModified)
//			setTitle(m_CaseID + " *");	
			setTitle(m_CaseName + " *");//22/02/2005 Mark Li: Add m_CaseName 
		else
//			setTitle(m_CaseID);
			setTitle(m_CaseName);//22/02/2005 Mark Li: Add m_CaseName
			
	}

	/**
	 * Gets modified state.
	 * @return true if Case Window is being modified; false otherwise.
	 */
	public boolean isModified() {
		return m_IsModified;
	}

	/**
	 * To save any changes of the Case represented by this CaseWindow.
	 */
	public void save() {
		try {
			m_CaseDiagramPanel.saveCaseDiagram();
			String caseID = CaseHandler.getInstance().storeCase(getCaseID());
			boolean caseNewFlag = m_IsNew;//<<29/03/2005 Mark Li:Add the node to tree if the case is new>>
			String oldCaseName = m_CaseName;
			if (!caseID.equals(m_CaseID)) {
				//m_ParentFrame.getMenuBarHandler().updateWindowMenuItem(
				//	m_CaseID,
			   //	caseID);
				setNew(false);
//				<<21/02/2005 Mark Li: Add Case Name
				setCaseID(m_CaseHandler.getCase(caseID, false).getTaskNode().getCaseID());
				setCaseName(m_CaseHandler.getCase(caseID,false).getTaskNode().getCaseName(), 0, false);//22/02/2005 Mark Li: Add setCaseName();
				setTitle(m_CaseName);
//				21/02/2005 Mark Li: Add Case Name>>				
			}
			setCaseName(m_CaseHandler.getCase(caseID,false).getTaskNode().getCaseName(), 0, false);//22/02/2005 Mark Li: Add setCaseName();
			m_ParentFrame.getMenuBarHandler().updateRecentFileList(
					m_CaseHandler.getCase(caseID, false).getTaskNode().getCaseName());
			m_ParentFrame.getMenuBarHandler().updateWindowMenuItem(
					oldCaseName,
					m_CaseName);							
			//<<21/03/2005 Mark Li: Add for dynamic update the Case List window
			if(caseNewFlag){//<<29/03/2005 Mark Li:Add the node to tree if the case is new>>
			m_ParentFrame.getManagementWindow().getCaseListPanel().getCaseListTree().addChildNode(m_CaseID);
			}else{
				m_ParentFrame.getManagementWindow().getCaseListPanel().getCaseListTree().removeChildNode(m_CaseID);
				m_ParentFrame.getManagementWindow().getCaseListPanel().getCaseListTree().addChildNode(m_CaseID);	
			}
			//21/03/2005 Mark Li: Add for dynamic update the Case List window>>
			if (isModified())
				setModified(false);
			//setTitle(m_CaseHandler.getCase(getCaseID(),false).getCaseID());    			

		} catch (BaseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	/**
	 * To close this CaseWindow
	 * @return true if user confirms to close this CaseWindow;
	 * false if user cancels the closing operation.
	 */
	public boolean close() {
		/*
		if (m_CaseDiagramPanel.getInternalForm() != null)
			 ((OperatorProperty) m_CaseDiagramPanel.getInternalForm()).close();
		*/
		//System.out.println("case is modified: " + m_IsModified);
		
		((DescriptionPanel)m_MessageTab.getComponentAt(0)).dispose();
		((SystemMessagePanel)m_MessageTab.getComponentAt(1)).dispose();
		
		if (!m_IsModified) {
			CaseHandler.getInstance().unregisterInterest(this);
			this.dispose(); //Should dispose before setFocus. TWang.
			m_CaseHandler.removeSystemMessageHandler(getCaseID());
			if(m_CaseHelpToolBarHandler!=null) {
				m_CaseHelpToolBarHandler.dispose();
				m_CaseHelpToolBarHandler = null;
			}
			m_CaseDiagramPanel.dispose();
			((ApplicationWindow) m_ParentFrame).setFocusToFirstCaseWindow(isMaximum());		
			Resource.removeIntereat(this);
			return true;
		}

		int option =
			JOptionPane.showConfirmDialog(
				(Component) this,
				Resource.srcStr("SaveChanges") + this.getTitle() + "\"?", 
				Resource.srcStr("AlphaMiner"), 
				JOptionPane.YES_NO_CANCEL_OPTION,
				JOptionPane.QUESTION_MESSAGE);
		if (option != JOptionPane.CANCEL_OPTION) {
			if (option == JOptionPane.YES_OPTION)
				save();
			else
            {
                	try
                	{
                		m_CaseHandler.getCase(getCaseID(), true);
                	} catch (BaseException e)
                	{
                		//System.err.println("Error in refreshing case (local copy)");
                	}
            }
			CaseHandler.getInstance().unregisterInterest(this);
			this.dispose();
			((ApplicationWindow) m_ParentFrame).setFocusToFirstCaseWindow(isMaximum());
			Resource.removeIntereat(this);
			return true;
		} else
			return false;
	}

	/**
	 * Transfer focus to the OperatorProperty belonging to it.
	 */
	public void setFocusOperatorProperty() {
		m_ParentFrame.getMenuBarHandler().selectCaseWindow(getCaseID());
	}

	/**
	 * Gets ID of Case represented by this CaseWindow.
	 * @return ID of the Case.
	 */
	public String getCaseID() {
		return m_CaseID;
	}

	/**
	 * Sets ID of Case represented by this CaseWindow.
	 * @param a_CaseID ID to be set.
	 */
	public void setCaseID(String a_CaseID) throws SysException{
		m_CaseID = a_CaseID;
		if (m_CaseDiagramPanel!=null)
		{
			m_CaseDiagramPanel.setCaseID(a_CaseID);
		}
	}
	
	//<<22/02/2005 Mark Li: Set Case Name as the title
	/**
	 * Sets Name of Case represented by this CaseWindow.
	 * @param a_CaseName to be set.
	 */
	public void setCaseName(String a_CaseName, int a_NewCaseIndex, boolean a_New) {
		int i = 0;
		
/*		if(m_CaseID != null || a_NewCaseIndex <= 0)
		{			
			for(;m_CaseID.charAt(i) == '0';i++);
			m_CaseName = a_CaseName +"( ID: "+m_CaseID.substring(i)+" )";
		}else
		{
			m_CaseName = a_CaseName +"("+m_CaseID+")";
		}*/
		
		if(a_New){
			m_CaseName = a_CaseName + a_NewCaseIndex + "*";
		}
		else
		{
			for(;m_CaseID.charAt(i) == '0';i++);
			m_CaseName = a_CaseName +"( ID: "+m_CaseID.substring(i)+" )";						
		}		
	}
	//22/02/2005 Mark Li: Set Case Name as the title>>

	public String getCaseName() {
		return m_CaseName;
	}
	
	/**
	 * Gets state of this Case.
	 * @return true if it is a newly created Case; false otherwise.
	 */
	public boolean getIsNew() {
		return m_IsNew;
	}

	/**
	 * Set state of this Case.
	 * @param a_IsNew true to set it as a new Case; false to set it as an old Case.
	 */
	public void setNew(boolean a_IsNew) {
		if (m_IsNew == a_IsNew)
			return;
		m_IsNew = a_IsNew;
	}
	
	/**
	 * @see javax.swing.event.InternalFrameListener#internalFrameClosing(InternalFrameEvent)
	 */
	public void internalFrameClosing(InternalFrameEvent e) {
		if (!isSelected()) {
			try {
				this.setSelected(true);
			} catch (java.beans.PropertyVetoException pe) {
			}
		}
		close();
	}

	/**
	 * @see javax.swing.event.InternalFrameListener#internalFrameClosed(InternalFrameEvent)
	 */
	public void internalFrameClosed(InternalFrameEvent e) {
		//m_ParentFrame.getMenuBarHandler().updateWindowMenu(getCaseID(), false);
		m_ParentFrame.getMenuBarHandler().updateWindowMenu(getCaseName(), false);
	}

	/**
	 * @see javax.swing.event.InternalFrameListener#internalFrameOpened(InternalFrameEvent)
	 */
	public void internalFrameOpened(InternalFrameEvent e) {
		m_CaseHandler.registerInterest(this);
		//<<01/04/2005, Frank J. Xu
		//m_ParentFrame.getMenuBarHandler().updateWindowMenu(getCaseID(), true);
		m_ParentFrame.getMenuBarHandler().updateWindowMenu(getCaseName(), true);
		//01/04/2005, Frank J. Xu>>
	}

	/**
	 * @see javax.swing.event.InternalFrameListener#internalFrameActivated(InternalFrameEvent)
	 */
	public void internalFrameActivated(InternalFrameEvent e) {
		notifyParent();
		m_ParentFrame.getMenuBarHandler().selectCaseWindow(getCaseID());
		m_ParentFrame.getMenuBarHandler().updateWindowMenuRecentCase(getCaseName());
		
		if (((BasicToolBarUI) m_CaseToolBar.getUI()).isFloating())
			((Window) m_CaseToolBar.getTopLevelAncestor()).setVisible(true);
			
		m_CaseDiagramPanel.getPanelDropTarget().setActive(true);
		if (m_CaseDiagramPanel.getInternalForm() != null) {
			m_CaseDiagramPanel.getInternalForm().setVisible(false);
			m_CaseDiagramPanel.getInternalForm().show();
		}
	}

	/**
	 * @see javax.swing.event.InternalFrameListener#internalFrameDeactivated(InternalFrameEvent)
	 */
	public void internalFrameDeactivated(InternalFrameEvent e) {
		m_ParentFrame.getMenuBarHandler().sendNotify("login");
		m_ParentFrame.getToolBarHandler().sendNotify("login");
		m_ParentFrame.getMenuBarHandler().selectCaseWindow(null);
		
		if (((BasicToolBarUI) m_CaseToolBar.getUI()).isFloating())
			((Window) m_CaseToolBar.getTopLevelAncestor()).setVisible(
				false);
		
		m_CaseDiagramPanel.getPanelDropTarget().setActive(false);
	}

	/**
	 * @see javax.swing.event.InternalFrameListener#internalFrameIconified(InternalFrameEvent)
	 */
	public void internalFrameIconified(InternalFrameEvent e) {
		try {
			setSelected(true);
		} catch (PropertyVetoException pe) {
		}
	}

	/**
	 * @see javax.swing.event.InternalFrameListener#internalFrameDeiconified(InternalFrameEvent)
	 */
	public void internalFrameDeiconified(InternalFrameEvent e) {
	}

	/**
	 * @see java.awt.event.MouseListener#mouseEntered(MouseEvent)
	 */
	public void mouseEntered(MouseEvent e) {
	}
	

	/**
	 * @see java.awt.event.MouseListener#mouseExited(MouseEvent)
	 */
	public void mouseExited(MouseEvent e) {
	}

	/**
	 * @see java.awt.event.MouseListener#mousePressed(MouseEvent)
	 */
	public void mousePressed(MouseEvent e) {
	    // <<25/07/2005 Kenneth Lai: Add for JHelp
	    if ( isHelpMode() ) {
	        setHelpMode(false);
	        HelpObserveSubject.sendNotify(false);
	    }
	    // 25/07/2005 Kenneth Lai: Add for JHelp>>
	}

	/**
	 * @see java.awt.event.MouseListener#mouseReleased(MouseEvent)
	 */
	public void mouseReleased(MouseEvent e) {
	}
	
	/**
	 * @see java.awt.event.MouseListener#mouseClicked(MouseEvent)
	 */
	public void mouseClicked(MouseEvent e) {
	}
	
	/**
	 * @see java.awt.event.MouseMotionListener#mouseMoved(MouseEvent)
	 */
	public void mouseMoved(MouseEvent e) {
	    HelpCursor helpCursor = new HelpCursor();

⌨️ 快捷键说明

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