From: <hee...@us...> - 2009-03-11 16:44:21
|
Revision: 1648 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1648&view=rev Author: heeroyuy Date: 2009-03-11 16:44:10 +0000 (Wed, 11 Mar 2009) Log Message: ----------- -some changes in the graphical panel Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -44,6 +44,7 @@ import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.owl.Description; + /** * This class processes input from the user. * @@ -54,7 +55,7 @@ MouseListener, ListSelectionListener, ListDataListener { // This is the DLLearnerModel. - + private final DLLearnerModel model; // This is the id that checks if the equivalent class or subclass button is @@ -71,6 +72,7 @@ private final Color colorRed = new Color(139, 0, 0); private final Color colorGreen = new Color(0, 139, 0); private final DLLearnerView view; + /** * This is the constructor for the action handler. * @@ -100,7 +102,7 @@ */ public void actionPerformed(ActionEvent z) { - if (z.getActionCommand().equals(id)) { + if (z.getActionCommand().equals("Suggest " + id +" description")) { model.setKnowledgeSource(); model.setReasoner(); model.setLearningProblem(); @@ -109,11 +111,12 @@ view.renderErrorMessage("learning started"); retriever = new SuggestionRetriever(); retriever.execute(); - //model.setCurrentConcept(null); + // model.setCurrentConcept(null); } if (z.getActionCommand().equals("ADD")) { + view.getMoreDetailForSuggestedConceptsPanel().repaint(); if (evaluatedDescription != null) { model .changeDLLearnerDescriptionsToOWLDescriptions(evaluatedDescription @@ -141,6 +144,7 @@ if (z.getActionCommand().equals("Why")) { view.getMoreDetailForSuggestedConceptsPanel().renderDetailPanel( evaluatedDescription); + view.getMoreDetailForSuggestedConceptsPanel().repaint(); } } @@ -205,10 +209,11 @@ .getSuggestClassPanel().getSuggestList().getSelectedValue(); String desc = item.getValue(); if (model.getEvaluatedDescriptionList() != null) { - List<? extends EvaluatedDescription> evalList = model.getEvaluatedDescriptionList(); + List<? extends EvaluatedDescription> evalList = model + .getEvaluatedDescriptionList(); Set<String> onto = model.getOntologyURIString(); - for(EvaluatedDescription eDescription : evalList) { - for(String ont : onto) { + for (EvaluatedDescription eDescription : evalList) { + for (String ont : onto) { if (desc.equals(eDescription.getDescription() .toManchesterSyntaxString(ont, null))) { evaluatedDescription = eDescription; @@ -217,11 +222,9 @@ } } } - - if (m.getClickCount() == 2) { - view.getMoreDetailForSuggestedConceptsPanel() - .renderDetailPanel(evaluatedDescription); - } + view.getMoreDetailForSuggestedConceptsPanel() + .renderDetailPanel(evaluatedDescription); + view.getMoreDetailForSuggestedConceptsPanel().repaint(); } } @@ -253,7 +256,7 @@ * Destroys the Thread after the Pluigin is closed. */ public void destroyDLLearnerThread() { - //dlLearner = null; + // dlLearner = null; } /** @@ -280,31 +283,36 @@ // TODO Auto-generated method stub } - - - -/** - * Inner Class that retrieves the concepts given by the DL-Learner. - * @author Christian Koetteritzsch - * - */ - class SuggestionRetriever extends + + /** + * Inner Class that retrieves the concepts given by the DL-Learner. + * + * @author Christian Koetteritzsch + * + */ + class SuggestionRetriever + extends SwingWorker<List<? extends EvaluatedDescription>, List<? extends EvaluatedDescription>> { - + private Thread dlLearner; private final DefaultListModel dm = new DefaultListModel(); - + @SuppressWarnings("unchecked") @Override - protected List<? extends EvaluatedDescription> doInBackground() throws Exception { + protected List<? extends EvaluatedDescription> doInBackground() + throws Exception { la = model.getLearningAlgorithm(); timer = new Timer(); - timer.schedule(new TimerTask(){ - + timer.schedule(new TimerTask() { + @Override - public void run() { + public void run() { if (la != null) { - publish(la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts(), view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy(), true)); + publish(la.getCurrentlyBestEvaluatedDescriptions(view + .getPosAndNegSelectPanel().getOptionPanel() + .getNrOfConcepts(), view + .getPosAndNegSelectPanel().getOptionPanel() + .getMinAccuracy(), false)); } } @@ -315,7 +323,7 @@ @Override public void run() { try { - model.run(); + model.run(); } catch (Exception e) { e.printStackTrace(); } @@ -330,8 +338,11 @@ // TODO Auto-generated catch block e.printStackTrace(); } - List<? extends EvaluatedDescription> result = la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts()); - + List<? extends EvaluatedDescription> result = la + .getCurrentlyBestEvaluatedDescriptions(view + .getPosAndNegSelectPanel().getOptionPanel() + .getNrOfConcepts()); + return result; } @@ -353,35 +364,49 @@ } @Override - protected void process(List<List<? extends EvaluatedDescription>> resultLists) { + protected void process( + List<List<? extends EvaluatedDescription>> resultLists) { - for (List<? extends EvaluatedDescription> list : resultLists) { updateList(list); } } - private void updateList(final List<? extends EvaluatedDescription> result) { + private void updateList( + final List<? extends EvaluatedDescription> result) { - Runnable doUpdateList = new Runnable() { - - public void run() { model.setSuggestList(result); dm.clear(); int i = 0; - for(EvaluatedDescription eval : result) { + for (EvaluatedDescription eval : result) { Set<String> ont = model.getOntologyURIString(); - for(String ontology : ont) { - if(eval.getDescription().toString().contains(ontology)) { - //dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(ontology, null), ((EvaluatedDescriptionClass)eval).getAccuracy()*100)); - if(model.isConsistent(eval)) { - dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(ontology, null), ((EvaluatedDescriptionClass) eval).getAccuracy()*100)); + for (String ontology : ont) { + if (eval.getDescription().toString().contains( + ontology)) { + // dm.add(i, new SuggestListItem(colorGreen, + // eval + // .getDescription().toManchesterSyntaxString + // (ontology, null), + // ((EvaluatedDescriptionClass) + // eval).getAccuracy()*100)); + if (model.isConsistent(eval)) { + dm.add(i, new SuggestListItem(colorGreen, + eval.getDescription() + .toManchesterSyntaxString( + ontology, null), + ((EvaluatedDescriptionClass) eval) + .getAccuracy() * 100)); break; } else { - dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(ontology, null), ((EvaluatedDescriptionClass) eval).getAccuracy()*100)); + dm.add(i, new SuggestListItem(colorRed, + eval.getDescription() + .toManchesterSyntaxString( + ontology, null), + ((EvaluatedDescriptionClass) eval) + .getAccuracy() * 100)); view.setIsInconsistent(true); break; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -102,10 +102,9 @@ private final JTextArea hint; private boolean isInconsistent; // This is the Panel for more details of the suggested concept - private MoreDetailForSuggestedConceptsPanel detail; + private final MoreDetailForSuggestedConceptsPanel detail; private ReadingOntologyThread readThread; private final OWLEditorKit editorKit; - private final String label; /** * The constructor for the DL-Learner tab in the class description @@ -115,7 +114,6 @@ * @param label String */ public DLLearnerView(String label, OWLEditorKit editor) { - this.label = label; editorKit = editor; model = new DLLearnerModel(editorKit, this); model.setID(label); @@ -129,7 +127,7 @@ adv = new JLabel("Advanced Settings"); advanced = new JToggleButton(icon); advanced.setVisible(true); - run = new JButton(label); + run = new JButton("Suggest " + label + " description"); accept = new JButton("ADD"); addButtonPanel = new JPanel(new BorderLayout()); sugPanel.addSuggestPanelMouseListener(action); @@ -141,13 +139,15 @@ learner = new JPanel(); advanced.setSize(20, 20); learner.setLayout(null); - learner.setPreferredSize(new Dimension(600, 520)); + //learner.setPreferredSize(new Dimension(600, 520)); + learner.setSize(new Dimension(1024, 768)); accept.setPreferredSize(new Dimension(290, 50)); advanced.setName("Advanced"); posPanel = new PosAndNegSelectPanel(model, action); - addAcceptButtonListener(this.action); - addRunButtonListener(this.action); - addAdvancedButtonListener(this.action); + detail = new MoreDetailForSuggestedConceptsPanel(model); + this.addAcceptButtonListener(this.action); + this.addRunButtonListener(this.action); + this.addAdvancedButtonListener(this.action); } @@ -171,6 +171,9 @@ */ public void makeView() { run.setEnabled(false); + System.out.println("hier"); + detail.unsetPanel(); + detail.setVisible(false); hint.setText("To get suggestions for class descriptions, please click the button above."); isInconsistent = false; readThread = new ReadingOntologyThread(editorKit, this, model); @@ -184,15 +187,16 @@ sugPanel = sugPanel.updateSuggestClassList(); advanced.setSelected(false); sugPanel.setBounds(10, 35, 490, 110); - adv.setBounds(40, 200, 200, 20); + adv.setBounds(40, 505, 200, 20); wikiPane.setBounds(220, 0, 350, 30); addButtonPanel.setBounds(510, 40, 80, 110); run.setBounds(10, 0, 200, 30); - advanced.setBounds(10, 200, 20, 20); + advanced.setBounds(10, 505, 20, 20); + detail.setBounds(10, 195, 600, 300); + detail.setVisible(true); sugPanel.setVisible(true); posPanel.setVisible(false); - posPanel.setBounds(10, 230, 490, 250); - posPanel.getOptionPanel().resetOptions(); + posPanel.setBounds(10, 535, 490, 250); accept.setBounds(510, 40, 80, 110); hint.setBounds(10, 150, 490, 35); errorMessage.setBounds(10, 180, 490, 20); @@ -205,8 +209,9 @@ learner.add(hint); learner.add(errorMessage); learner.add(posPanel); + learner.add(detail); this.renderErrorMessage(""); - detail = new MoreDetailForSuggestedConceptsPanel(model); + } /** * This method sets the right icon for the advanced Panel. @@ -243,6 +248,7 @@ */ public void setExamplePanelVisible(boolean visible) { posPanel.setVisible(visible); + detail.repaint(); } /** @@ -350,7 +356,7 @@ * This method sets the run button enable after learning. */ public void algorithmTerminated() { - String error = "learning succesful"; + String error = "learning successful"; String message = ""; if(isInconsistent) { message = "Class descriptions marked red will lead to an inconsistent ontology. \nPlease double click on them to view detail information."; Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -19,6 +19,7 @@ */ package org.dllearner.tools.protege; +import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; @@ -32,24 +33,29 @@ import org.dllearner.algorithms.EvaluatedDescriptionClass; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.owl.Individual; + /** * This class draws the graphical coverage of a learned concept. + * * @author Christian Koetteritzsch - * + * */ public class GraphicalCoveragePanel extends JPanel { private static final long serialVersionUID = 855436961912515267L; - private static final int HEIGHT =250; - private static final int WIDTH = 250; + private static final int HEIGHT = 150; + private static final int WIDTH = 150; + private static final int ELLIPSE_X_AXIS = 5; + private static final int ELLIPSE_Y_AXIS = 25; private static final int MAX_NUMBER_OF_INDIVIDUAL_POINTS = 20; + private static final int PLUS_SIZE = 5; private static final int GAP = 20; private int shiftXAxis; private int distortionOld; private final Ellipse2D oldConcept; private Ellipse2D newConcept; - private final EvaluatedDescription eval; + private EvaluatedDescription eval; private final DLLearnerModel model; private final String conceptNew; private final Vector<IndividualPoint> posCovIndVector; @@ -57,24 +63,43 @@ private final Vector<IndividualPoint> points; private final GraphicalCoveragePanelHandler handler; private int adjustment; + private int shiftOldConcept; + private int shiftNewConcept; + private int shiftNewConceptX; + private int shiftCovered; + private int coveredIndividualSize; + private int additionalIndividualSize; + private int x1; + private int x2; + private int y1; + private int y2; + private int centerX; + private int centerY; private final MoreDetailForSuggestedConceptsPanel panel; /** * * This is the constructor for the GraphicalCoveragePanel. - * - * @param desc EvaluatedDescription - * @param m DLLearnerModel - * @param concept String - * @param w width - * @param h height - * @param p MoreDetailForSuggestedConceptsPanel + * + * @param desc + * EvaluatedDescription + * @param m + * DLLearnerModel + * @param concept + * String + * @param w + * width + * @param h + * height + * @param p + * MoreDetailForSuggestedConceptsPanel */ - public GraphicalCoveragePanel(EvaluatedDescription desc, DLLearnerModel m, String concept, int w, int h, MoreDetailForSuggestedConceptsPanel p) { - setPreferredSize(new Dimension(WIDTH, HEIGHT)); - setVisible(true); - setForeground(Color.GREEN); - repaint(); + public GraphicalCoveragePanel(EvaluatedDescription desc, DLLearnerModel m, + String concept, int w, int h, MoreDetailForSuggestedConceptsPanel p) { + this.setPreferredSize(new Dimension(WIDTH, HEIGHT + 100)); + this.setVisible(false); + this.setForeground(Color.GREEN); + this.repaint(); eval = desc; model = m; panel = p; @@ -83,198 +108,416 @@ posNotCovIndVector = new Vector<IndividualPoint>(); points = new Vector<IndividualPoint>(); this.computeGraphics(); - handler = new GraphicalCoveragePanelHandler(this); - oldConcept = new Ellipse2D.Float(5, 25+adjustment, WIDTH-distortionOld, HEIGHT-distortionOld); - newConcept = new Ellipse2D.Float(5+shiftXAxis, 25, WIDTH, HEIGHT); + handler = new GraphicalCoveragePanelHandler(this, desc, model); + oldConcept = new Ellipse2D.Float(ELLIPSE_X_AXIS + (2 * adjustment), + ELLIPSE_Y_AXIS, WIDTH, HEIGHT); + newConcept = new Ellipse2D.Float(ELLIPSE_X_AXIS + shiftXAxis + + adjustment, ELLIPSE_Y_AXIS, WIDTH + distortionOld, HEIGHT + + distortionOld); this.computeIndividualPoints(); this.addMouseMotionListener(handler); - this.addPropertyChangeListener(handler); + this.addMouseListener(handler); + // this.addPropertyChangeListener(handler); } - + @Override protected void paintComponent(Graphics g) { - Graphics2D g2D; - g2D = (Graphics2D) g; - g2D.setColor(Color.GREEN); - g2D.draw(oldConcept); - g2D.drawString(model.getOldConceptOWLAPI().toString(), 10, 15); - g2D.setColor(Color.RED); - g2D.draw(newConcept); - g2D.drawString(conceptNew, 10 + WIDTH, 15); - - - - for(int i = 0; i < posCovIndVector.size(); i++) { + if (eval != null) { + Graphics2D g2D; + g2D = (Graphics2D) g; + + AlphaComposite ac = AlphaComposite.getInstance( + AlphaComposite.SRC_OVER, 0.5f); + g2D.setColor(Color.YELLOW); + g2D.fill(oldConcept); g2D.setColor(Color.BLACK); - g2D.drawString(posCovIndVector.get(i).getPoint(), posCovIndVector.get(i).getXAxis(), posCovIndVector.get(i).getYAxis()); - } - - for(int i = 0; i < posNotCovIndVector.size(); i++) { + g2D.drawString(model.getOldConceptOWLAPI().toString(), 10, 15); g2D.setColor(Color.BLACK); - g2D.drawString(posNotCovIndVector.get(i).getPoint(), posNotCovIndVector.get(i).getXAxis(), posNotCovIndVector.get(i).getYAxis()); + g2D.drawString(conceptNew, 10 + WIDTH, 15); + g2D.setComposite(ac); + g2D.setColor(Color.ORANGE); + g2D.fill(newConcept); + g2D.setColor(Color.BLACK); + + // Plus 1 + if (coveredIndividualSize != model.getReasoner().getIndividuals( + model.getCurrentConcept()).size() + && coveredIndividualSize != 0) { + g2D.drawLine(x1 - 1 - shiftOldConcept, y1 - 1, x2 + 1 + - shiftOldConcept, y1 - 1); + g2D.drawLine(x1 - shiftOldConcept, centerY - 1, x2 + - shiftOldConcept, centerY - 1); + g2D.drawLine(x1 - shiftOldConcept, centerY, x2 + - shiftOldConcept, centerY); + g2D.drawLine(x1 - shiftOldConcept, centerY + 1, x2 + - shiftOldConcept, centerY + 1); + g2D.drawLine(x1 - 1 - shiftOldConcept, y2 + 1, x2 + 1 + - shiftOldConcept, y2 + 1); + + g2D.drawLine(x1 - 1 - shiftOldConcept, y1 - 1, x1 - 1 + - shiftOldConcept, y2 + 1); + g2D.drawLine(centerX - 1 - shiftOldConcept, y1, centerX - 1 + - shiftOldConcept, y2); + g2D.drawLine(centerX - shiftOldConcept, y1, centerX + - shiftOldConcept, y2); + g2D.drawLine(centerX + 1 - shiftOldConcept, y1, centerX + 1 + - shiftOldConcept, y2); + g2D.drawLine(x2 + 1 - shiftOldConcept, y1 - 1, x2 + 1 + - shiftOldConcept, y2 + 1); + } + // Plus 2 + + g2D.drawLine(x1 - 1 + shiftCovered, y1 - 1, x2 + 1 + shiftCovered, + y1 - 1); + g2D.drawLine(x1 + shiftCovered, centerY - 1, x2 + shiftCovered, + centerY - 1); + g2D + .drawLine(x1 + shiftCovered, centerY, x2 + shiftCovered, + centerY); + g2D.drawLine(x1 + shiftCovered, centerY + 1, x2 + shiftCovered, + centerY + 1); + g2D.drawLine(x1 - 1 + shiftCovered, y2 + 1, x2 + 1 + shiftCovered, + y2 + 1); + + g2D.drawLine(x1 - 1 + shiftCovered, y1 - 1, x1 - 1 + shiftCovered, + y2 + 1); + g2D.drawLine(centerX - 1 + shiftCovered, y1, centerX - 1 + + shiftCovered, y2); + g2D + .drawLine(centerX + shiftCovered, y1, centerX + + shiftCovered, y2); + g2D.drawLine(centerX + 1 + shiftCovered, y1, centerX + 1 + + shiftCovered, y2); + g2D.drawLine(x2 + 1 + shiftCovered, y1 - 1, x2 + 1 + shiftCovered, + y2 + 1); + + // Plus 3 + if (coveredIndividualSize != model.getReasoner().getIndividuals( + model.getCurrentConcept()).size()) { + g2D.drawLine(x1 - 1 + shiftNewConcept, y1 - 1, x2 + 1 + + shiftNewConcept, y1 - 1); + g2D.drawLine(x1 + shiftNewConcept, centerY - 1, x2 + + shiftNewConcept, centerY - 1); + g2D.drawLine(x1 + shiftNewConcept, centerY, x2 + + shiftNewConcept, centerY); + g2D.drawLine(x1 + shiftNewConcept, centerY + 1, x2 + + shiftNewConcept, centerY + 1); + g2D.drawLine(x1 - 1 + shiftNewConcept, y2 + 1, x2 + 1 + + shiftNewConcept, y2 + 1); + + g2D.drawLine(x1 - 1 + shiftNewConcept, y1 - 1, x1 - 1 + + shiftNewConcept, y2 + 1); + g2D.drawLine(centerX - 1 + shiftNewConcept, y1, centerX - 1 + + shiftNewConcept, y2); + g2D.drawLine(centerX + shiftNewConcept, y1, centerX + + shiftNewConcept, y2); + g2D.drawLine(centerX + 1 + shiftNewConcept, y1, centerX + 1 + + shiftNewConcept, y2); + g2D.drawLine(x2 + 1 + shiftNewConcept, y1 - 1, x2 + 1 + + shiftNewConcept, y2 + 1); + } + + if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0) { + g2D.drawLine(x1 - 1 + shiftNewConceptX, y1 - 1 + + shiftNewConcept, x2 + 1 + shiftNewConceptX, y1 - 1 + + shiftNewConcept); + g2D.drawLine(x1 + shiftNewConceptX, centerY - 1 + + shiftNewConcept, x2 + shiftNewConceptX, centerY - 1 + + shiftNewConcept); + g2D.drawLine(x1 + shiftNewConceptX, centerY + shiftNewConcept, + x2 + shiftNewConceptX, centerY + shiftNewConcept); + g2D.drawLine(x1 + shiftNewConceptX, centerY + 1 + + shiftNewConcept, x2 + shiftNewConceptX, centerY + 1 + + shiftNewConcept); + g2D.drawLine(x1 - 1 + shiftNewConceptX, y2 + 1 + + shiftNewConcept, x2 + 1 + shiftNewConceptX, y2 + 1 + + shiftNewConcept); + + g2D.drawLine(x1 - 1 + shiftNewConceptX, y1 - 1 + + shiftNewConcept, x1 - 1 + shiftNewConceptX, y2 + 1 + + shiftNewConcept); + g2D.drawLine(centerX - 1 + shiftNewConceptX, y1 + + shiftNewConcept, centerX - 1 + shiftNewConceptX, y2 + + shiftNewConcept); + g2D.drawLine(centerX + shiftNewConceptX, y1 + shiftNewConcept, + centerX + shiftNewConceptX, y2 + shiftNewConcept); + g2D.drawLine(centerX + 1 + shiftNewConceptX, y1 + + shiftNewConcept, centerX + 1 + shiftNewConceptX, y2 + + shiftNewConcept); + g2D.drawLine(x2 + 1 + shiftNewConceptX, y1 - 1 + + shiftNewConcept, x2 + 1 + shiftNewConceptX, y2 + 1 + + shiftNewConcept); + } + + for (int i = 0; i < posCovIndVector.size(); i++) { + g2D.setColor(Color.GREEN); + g2D.drawString(posCovIndVector.get(i).getPoint(), + posCovIndVector.get(i).getXAxis(), posCovIndVector.get( + i).getYAxis()); + } + + for (int i = 0; i < posNotCovIndVector.size(); i++) { + g2D.setColor(Color.RED); + g2D.drawString(posNotCovIndVector.get(i).getPoint(), + posNotCovIndVector.get(i).getXAxis(), + posNotCovIndVector.get(i).getYAxis()); + } + this.setVisible(true); + panel.repaint(); } + } + private void computeGraphics() { + if (eval != null) { + this.setVisible(true); + panel.repaint(); + additionalIndividualSize = ((EvaluatedDescriptionClass) eval) + .getAdditionalInstances().size(); + distortionOld = 0; + adjustment = 0; + Ellipse2D old = new Ellipse2D.Float(ELLIPSE_X_AXIS, ELLIPSE_Y_AXIS, + WIDTH, HEIGHT); + x1 = (int) old.getCenterX() - PLUS_SIZE; + x2 = (int) old.getCenterX() + PLUS_SIZE; + y1 = (int) old.getCenterY() - PLUS_SIZE; + y2 = (int) old.getCenterY() + PLUS_SIZE; + centerX = (int) old.getCenterX(); + centerY = (int) old.getCenterY(); + double coverage = ((EvaluatedDescriptionClass) eval).getCoverage(); + shiftXAxis = (int) Math.round(WIDTH * (1 - coverage)); + if (additionalIndividualSize != 0) { + distortionOld = (int) Math.round(WIDTH * 0.3); + newConcept = new Ellipse2D.Float(ELLIPSE_X_AXIS + shiftXAxis, + ELLIPSE_Y_AXIS, WIDTH, HEIGHT); + adjustment = (int) Math.round(newConcept.getCenterY() / 4); + } + this.renderPlus(); + } } - - private void computeGraphics(){ - int add = ((EvaluatedDescriptionClass) eval).getAdditionalInstances().size(); - distortionOld = 0; - adjustment = 0; - double additional = ((EvaluatedDescriptionClass) eval).getAddition(); - double coverage = ((EvaluatedDescriptionClass) eval).getCoverage(); - shiftXAxis = (int) Math.round(WIDTH* (1-coverage)); - if(add != 0) { - distortionOld = (int) Math.round(WIDTH*additional); - newConcept = new Ellipse2D.Float(5+shiftXAxis, 25, WIDTH, HEIGHT); - adjustment = (int) Math.round(newConcept.getCenterY()/4); - + + private void renderPlus() { + if (eval != null) { + coveredIndividualSize = ((EvaluatedDescriptionClass) eval) + .getCoveredInstances().size(); + double newConcept = ((EvaluatedDescriptionClass) eval) + .getAddition(); + double oldConcept = ((EvaluatedDescriptionClass) eval) + .getCoverage(); + shiftNewConcept = 0; + shiftOldConcept = 0; + shiftNewConceptX = 0; + shiftCovered = 0; + if (coveredIndividualSize == 0) { + shiftNewConcept = (int) Math.round((WIDTH / 2.0) * newConcept); + } else if (additionalIndividualSize != coveredIndividualSize) { + shiftNewConcept = (int) Math.round((WIDTH / 2.0) + * (newConcept + (1 - oldConcept))); + shiftOldConcept = (int) Math.round((WIDTH / 2.0) * oldConcept); + shiftCovered = (int) Math.round((WIDTH / 2.0) + * (1 - oldConcept)); + } + if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0) { + shiftCovered = (int) Math.round((WIDTH / 2.0) * 0.625); + shiftNewConceptX = shiftCovered; + shiftNewConcept = 2 * shiftNewConceptX; + } } - } - + private void computeIndividualPoints() { - Set<Individual> posInd = ((EvaluatedDescriptionClass) eval).getCoveredInstances(); + if (eval != null) { + Set<Individual> posInd = ((EvaluatedDescriptionClass) eval) + .getCoveredInstances(); + int i = 0; + double x = 100; + double y = 100; + boolean flag = true; + for (Individual ind : posInd) { + flag = true; + if (i < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { + while (flag) { + if (x >= oldConcept.getMaxX()) { + x = (int) oldConcept.getMinX(); + y = y + GAP; + } - int i = 0; - double x = 20; - double y = 20; - boolean flag = true; - for(Individual ind : posInd) { - flag = true; - if(i<MAX_NUMBER_OF_INDIVIDUAL_POINTS) { - while(flag) { - if(x >= oldConcept.getMaxX()) { - x = (int) oldConcept.getMinX(); - y = y + GAP; - } - - if(y >= oldConcept.getMaxY()) { - y = (int) oldConcept.getMinY(); - } - - if(x >= newConcept.getMaxX()) { - x = (int) newConcept.getMinX(); - y = y + GAP; - } - - if(y >= newConcept.getMaxY()) { - y = (int) newConcept.getMinY(); - break; - } - - while(x < newConcept.getMaxX()) { - - if(newConcept.contains(x, y) && oldConcept.contains(x, y)) { - posCovIndVector.add(new IndividualPoint("+", (int) x, (int) y, ind.toString())); - i++; - flag = false; - x = x + GAP; + if (y >= oldConcept.getMaxY()) { + y = (int) oldConcept.getMinY(); + } + + if (x >= newConcept.getMaxX()) { + x = (int) newConcept.getMinX(); + y = y + GAP; + } + + if (y >= newConcept.getMaxY()) { + y = (int) newConcept.getMinY(); break; - } else { - x = x + GAP; } + + while (x < newConcept.getMaxX()) { + + if (newConcept.contains(x, y) + && oldConcept.contains(x, y)) { + posCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toString())); + i++; + flag = false; + x = x + GAP; + break; + } else { + x = x + GAP; + } + } } } } - } - - Set<Individual> posNotCovInd = ((EvaluatedDescriptionClass) eval).getAdditionalInstances(); - int j = 0; - x = 20; - y = 20; - for(Individual ind : posNotCovInd) { - flag = true; - if(j<MAX_NUMBER_OF_INDIVIDUAL_POINTS) { - while(flag) { - if(x >= newConcept.getMaxX()) { - x = (int) oldConcept.getMinX(); - y = y + GAP; - } - - if(y >= newConcept.getMaxY()) { - y = (int) oldConcept.getMinY(); - break; - } - - while(x < newConcept.getMaxX()) { - - if(!oldConcept.contains(x, y) && newConcept.contains(x, y)) { - posNotCovIndVector.add(new IndividualPoint("-", (int) x, (int) y, ind.toString())); - j++; - flag = false; - x = x + GAP; + + Set<Individual> posNotCovInd = ((EvaluatedDescriptionClass) eval) + .getAdditionalInstances(); + int j = 0; + x = 100; + y = 100; + for (Individual ind : posNotCovInd) { + flag = true; + if (j < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { + while (flag) { + if (x >= newConcept.getMaxX()) { + x = (int) oldConcept.getMinX(); + y = y + GAP; + } + + if (y >= newConcept.getMaxY()) { + y = (int) oldConcept.getMinY(); break; - } else { - x = x + GAP; } + + while (x < newConcept.getMaxX()) { + + if (!oldConcept.contains(x, y) + && newConcept.contains(x, y)) { + posNotCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toString())); + j++; + flag = false; + x = x + GAP; + break; + } else { + x = x + GAP; + } + } } } } - } - - Set<Individual> notCovInd = model.getReasoner().getIndividuals(model.getCurrentConcept()); - notCovInd.removeAll(posInd); - int k = 0; - x = 20; - y = 20; - for(Individual ind : notCovInd) { - flag = true; - if(k < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { - while(flag) { - if(x >= oldConcept.getMaxX()) { - x = (int) oldConcept.getMinX(); - y = y + GAP; - } - - if(y >= oldConcept.getMaxY()) { - y = (int) oldConcept.getMinY(); - break; - } - - while(x < oldConcept.getMaxX()) { - - if(oldConcept.contains(x, y) && !newConcept.contains(x, y)) { - posNotCovIndVector.add(new IndividualPoint("-", (int) x, (int) y, ind.toString())); - k++; - flag = false; - x = x + GAP; + + Set<Individual> notCovInd = model.getReasoner().getIndividuals( + model.getCurrentConcept()); + notCovInd.removeAll(posInd); + int k = 0; + x = 100; + y = 100; + for (Individual ind : notCovInd) { + flag = true; + if (k < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { + while (flag) { + if (x >= oldConcept.getMaxX()) { + x = (int) oldConcept.getMinX(); + y = y + GAP; + } + + if (y >= oldConcept.getMaxY()) { + y = (int) oldConcept.getMinY(); break; - } else { - x = x + GAP; } + + while (x < oldConcept.getMaxX()) { + + if (oldConcept.contains(x, y) + && !newConcept.contains(x, y)) { + posNotCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toString())); + k++; + flag = false; + x = x + GAP; + break; + } else { + x = x + GAP; + } + } } } } + points.addAll(posCovIndVector); + points.addAll(posNotCovIndVector); } - points.addAll(posCovIndVector); - points.addAll(posNotCovIndVector); } - + /** - * This method returns a Vector of all individuals that are drawn - * in the panel. + * This method returns a Vector of all individuals that are drawn in the + * panel. + * * @return Vector of Individuals */ public Vector<IndividualPoint> getIndividualVector() { return points; } - + /** * This method returns the GraphicalCoveragePanel. + * * @return GraphicalCoveragePanel */ public GraphicalCoveragePanel getGraphicalCoveragePanel() { return this; } - + /** * This method returns the MoreDetailForSuggestedConceptsPanel. + * * @return MoreDetailForSuggestedConceptsPanel */ public MoreDetailForSuggestedConceptsPanel getMoreDetailForSuggestedConceptsPanel() { return panel; } + + public int getX1() { + return x1; + } + + public int getX2() { + return x2; + } + + public int getY1() { + return y1; + } + + public int getY2() { + return y2; + } + + public int getShiftOldConcept() { + return shiftOldConcept; + } + + public int getShiftCovered() { + return shiftCovered; + } + + public int getShiftNewConcept() { + return shiftNewConcept; + } + + public int getShiftNewConceptX() { + return shiftNewConceptX; + } + + public void unsetPanel() { + this.removeAll(); + eval = null; + } - - + public EvaluatedDescription getEvaluateddescription() { + return eval; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -20,27 +20,46 @@ package org.dllearner.tools.protege; import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.Set; import java.util.Vector; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import org.dllearner.algorithms.EvaluatedDescriptionClass; +import org.dllearner.core.EvaluatedDescription; +import org.dllearner.core.owl.Individual; + /** * This class takes care of all events happening in the GraphicalCoveragePanel. + * * @author Christian Koetteritzsch - * + * */ -public class GraphicalCoveragePanelHandler implements MouseMotionListener, PropertyChangeListener { +public class GraphicalCoveragePanelHandler implements MouseMotionListener, + MouseListener, PropertyChangeListener { private final GraphicalCoveragePanel panel; + private final EvaluatedDescription description; + private final DLLearnerModel model; + private final JPopupMenu popup; /** * This is the constructor for the handler. - * @param p GraphicalCoveragePanel + * + * @param p + * GraphicalCoveragePanel */ - public GraphicalCoveragePanelHandler(GraphicalCoveragePanel p) { + public GraphicalCoveragePanelHandler(GraphicalCoveragePanel p, + EvaluatedDescription eval, DLLearnerModel m) { this.panel = p; + description = eval; + model = m; + popup = new JPopupMenu(); } @Override @@ -51,13 +70,15 @@ @Override public void mouseMoved(MouseEvent m) { + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); Vector<IndividualPoint> v = panel.getIndividualVector(); for (int i = 0; i < v.size(); i++) { if (v.get(i).getXAxis() >= m.getX() - 5 && v.get(i).getXAxis() <= m.getX() + 5 && v.get(i).getYAxis() >= m.getY() - 5 && v.get(i).getYAxis() <= m.getY() + 5) { - panel.getGraphicalCoveragePanel().setToolTipText(v.get(i).getIndividualName()); + panel.getGraphicalCoveragePanel().setToolTipText( + v.get(i).getIndividualName()); } } @@ -66,8 +87,94 @@ @Override public void propertyChange(PropertyChangeEvent arg0) { - panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + panel.repaint(); } + @Override + public void mouseClicked(MouseEvent arg0) { + if (panel.getEvaluateddescription() != null) { + if (arg0.getX() >= panel.getX1() + panel.getShiftCovered() + && arg0.getX() <= panel.getX2() + panel.getShiftCovered() + && arg0.getY() >= panel.getY1() + && arg0.getY() <= panel.getY2()) { + popup.removeAll(); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + Set<Individual> covInd = ((EvaluatedDescriptionClass) description) + .getCoveredInstances(); + for (Individual ind : covInd) { + popup.add(new JMenuItem(ind.toString())); + } + popup.show(panel, arg0.getX(), arg0.getY()); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + } + if (arg0.getX() >= panel.getX1() + panel.getShiftNewConcept() + && arg0.getX() <= panel.getX2() + + panel.getShiftNewConcept() + && arg0.getY() >= panel.getY1() + && arg0.getY() <= panel.getY2() + || arg0.getX() >= panel.getX1() + + panel.getShiftNewConceptX() + && arg0.getX() <= panel.getX2() + + panel.getShiftNewConceptX() + && arg0.getY() >= panel.getY1() + + panel.getShiftNewConcept() + && arg0.getY() <= panel.getY2() + + panel.getShiftNewConcept()) { + popup.removeAll(); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + Set<Individual> addInd = ((EvaluatedDescriptionClass) description) + .getAdditionalInstances(); + for (Individual ind : addInd) { + popup.add(new JMenuItem(ind.toString())); + } + popup.show(panel, arg0.getX(), arg0.getY()); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + } + + if (arg0.getX() >= panel.getX1() - panel.getShiftOldConcept() + && arg0.getX() <= panel.getX2() + - panel.getShiftOldConcept() + && arg0.getY() >= panel.getY1() + && arg0.getY() <= panel.getY2()) { + popup.removeAll(); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + Set<Individual> notCovInd = model.getReasoner().getIndividuals( + model.getCurrentConcept()); + notCovInd.removeAll(((EvaluatedDescriptionClass) description) + .getCoveredInstances()); + for (Individual ind : notCovInd) { + popup.add(new JMenuItem(ind.toString())); + } + popup.show(panel, arg0.getX(), arg0.getY()); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + } + } + } + + @Override + public void mouseEntered(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -18,18 +18,12 @@ * */ package org.dllearner.tools.protege; -import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.util.Set; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.JScrollPane; import javax.swing.JTextArea; -import javax.swing.WindowConstants; import org.dllearner.algorithms.EvaluatedDescriptionClass; import org.dllearner.core.EvaluatedDescription; @@ -54,73 +48,22 @@ // Textarea to render the accuracy of the concept - private JTextArea accuracy; - - // Label for the positive examples that are covered by the concept + private final JTextArea accuracy; + - private JLabel coveredPositiveExamples; - - // Label for the negative examples that are covered by the concept - - private JLabel coveredNegativeExamples; - - // Label for the positive examples that are not covered by the concept - - private JLabel notCoveredPositiveExamples; - - // Label for the negative examples that are not covered by the concept - - private JLabel notCoveredNegativeExamples; - - // Pop up panel for the informations of the selected concept - - private JDialog detailPopup; - - // Text area that shows the covered positive examples - - private JTextArea posCoveredText; - - // Text area that shows the positive examples that are not covered by the selected concept - - private JTextArea posNotCoveredText; - - // Text area that shows the covered negative examples - - private JTextArea negCoveredText; - - // Text area that shows the negative examples that are not covered by the selected concept - - private JTextArea negNotCoveredText; - - // Text area that shows the accurcy of the selected concept - - private JTextArea accuracyText; - - // Scroll pane if scroll bar is necessary to show all covered examples - - private JScrollPane posCoveredScroll; - private JScrollPane posNotCoveredScroll; - private JScrollPane negCoveredScroll; - private JScrollPane negNotCoveredScroll; + private final JTextArea accuracyText; // Evaluated description of the selected concept - private JPanel conceptPanel; - private JPanel accuracyPanel; - private JPanel posCoveredPanel; - private JPanel posNotCoveredPanel; - private JPanel negCoveredPanel; - private JPanel negNotCoveredPanel; + private final JPanel conceptPanel; + private EvaluatedDescription eval; - private JTextArea concept; + private final JTextArea concept; private Set<String> ontologiesStrings; - private JTextArea conceptText; - private final Color colorRed = new Color(139, 0, 0); - private final Color colorGreen = new Color(0, 139, 0); + private final JTextArea conceptText; private static final int HEIGHT = 500; private static final int WIDTH = 600; private GraphicalCoveragePanel p; - private final JButton allPositiveIndividuals; - private final JButton allNegativeIndividuals; private final MoreDetailForSuggestedConceptsPanelHandler handler; + /** * This is the constructor for the Panel. * @param model DLLearnerModel @@ -130,145 +73,68 @@ setLayout(null); setPreferredSize(new Dimension(WIDTH, HEIGHT)); this.model = model; - handler = new MoreDetailForSuggestedConceptsPanelHandler(model); - allPositiveIndividuals = new JButton("old"); - allPositiveIndividuals.setBounds(100, 400, 50, 30); - allPositiveIndividuals.addActionListener(handler); - - allNegativeIndividuals = new JButton("new"); - allNegativeIndividuals.setBounds(400, 400, 50, 30); - allNegativeIndividuals.addActionListener(handler); - - - - } - /** - * This method returns the Detail Panel. - * @return DetailPanel - */ - public JDialog getMoreDialog() { - return detailPopup; - } - - /** - * This method renders the output for the detail panel. - * @param desc selected description - */ - public void renderDetailPanel(EvaluatedDescription desc) { - unsetEverything(); - posCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - posCoveredScroll.setBounds(5, 150, 280, 140); - posNotCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - posNotCoveredScroll.setBounds(300, 150, 280, 140); - negCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - negCoveredScroll.setBounds(5, 325, 280, 140); - negNotCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - negNotCoveredScroll.setBounds(300, 325, 280, 140); - eval = desc; + handler = new MoreDetailForSuggestedConceptsPanelHandler(this); concept = new JTextArea("Class Description:"); concept.setEditable(false); - coveredPositiveExamples = new JLabel("Covered Positive Examples:"); - coveredPositiveExamples.setForeground(colorGreen); - coveredPositiveExamples.setBounds(5, 110, 280, 30); - notCoveredPositiveExamples = new JLabel("Not Covered Positive Examples"); - notCoveredPositiveExamples.setForeground(colorRed); - notCoveredPositiveExamples.setBounds(300, 110, 280, 30); - coveredNegativeExamples = new JLabel("Covered Negative Examples:"); - coveredNegativeExamples.setForeground(colorRed); - coveredNegativeExamples.setBounds(5, 295, 280, 30); - notCoveredNegativeExamples = new JLabel("Not Covered Negative Examples"); - notCoveredNegativeExamples.setForeground(colorGreen); - notCoveredNegativeExamples.setBounds(300, 295, 280, 30); - conceptPanel = new JPanel(new GridLayout(0, 1)); - conceptPanel.setBounds(5, 0, 600, 50); - accuracyPanel = new JPanel(new GridLayout(0, 1)); - accuracyPanel.setBounds(5, 60, 600, 50); + + conceptPanel = new JPanel(new GridLayout(0, 2)); + conceptPanel.setBounds(5, 0, 800, 50); - posCoveredPanel = new JPanel(new GridLayout(0, 1)); - posNotCoveredPanel = new JPanel(new GridLayout(0, 1)); - negCoveredPanel = new JPanel(new GridLayout(0, 1)); - negNotCoveredPanel = new JPanel(new GridLayout(0, 1)); accuracy = new JTextArea("Accuracy:"); accuracy.setEditable(false); conceptText = new JTextArea(); conceptText.setEditable(false); - posCoveredText = new JTextArea(); - posCoveredText.setForeground(colorGreen); - //sets covered positive examples text area not editable - posCoveredText.setEditable(false); - posNotCoveredText = new JTextArea(); - posNotCoveredText.setForeground(colorRed); - //sets not covered positive examples text area not editable - posNotCoveredText.setEditable(false); - negCoveredText = new JTextArea(); - negCoveredText.setForeground(colorRed); - //sets covered negative examples text area not editable - negCoveredText.setEditable(false); - negNotCoveredText = new JTextArea(); - negNotCoveredText.setForeground(colorGreen); - //sets not covered negative examples text area not editable - negNotCoveredText.setEditable(false); + accuracyText = new JTextArea(); //sets accuracy text area not editable accuracyText.setEditable(false); + accuracy.setVisible(false); + accuracyText.setVisible(false); + concept.setVisible(false); + conceptText.setVisible(false); + + } + + /** + * This method renders the output for the detail panel. + * @param desc selected description + */ + public void renderDetailPanel(EvaluatedDescription desc) { + accuracy.setVisible(false); + accuracyText.setVisible(false); + concept.setVisible(false); + conceptText.setVisible(false); + eval = desc; + //panel for the informations of the selected concept //this method adds the informations for the selected concept to the panel - setInformation(); + this.setInformation(); p = new GraphicalCoveragePanel(eval, model, conceptText.getText(), WIDTH, HEIGHT-200, this); - p.setBounds(5, 110, 600, 300); - detailPopup = new JDialog(); - detailPopup.setSize(WIDTH, HEIGHT); - //window will be disposed if the x button is pressed - detailPopup.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - detailPopup.setVisible(true); - detailPopup.setResizable(false); + p.setBounds(5, 60, 600, 350); //adds all information to the example panel + unsetEverything(); + conceptPanel.removeAll(); conceptPanel.add(concept); + conceptPanel.add(accuracy); conceptPanel.add(conceptText); - - accuracyPanel.add(accuracy); - accuracyPanel.add(accuracyText); - - posCoveredScroll.setViewportView(posCoveredPanel); - posNotCoveredScroll.setViewportView(posNotCoveredPanel); - negCoveredScroll.setViewportView(negCoveredPanel); - negNotCoveredScroll.setViewportView(negNotCoveredPanel); - - add(conceptPanel); - add(accuracyPanel); - add(p); - add(allPositiveIndividuals); - add(allNegativeIndividuals); - handler.setEvaluadtedDescription(eval); - detailPopup.add(this); + conceptPanel.add(accuracyText); + conceptPanel.setVisible(true); + this.add(conceptPanel); + this.add(p); + this.addPropertyChangeListener(handler); + conceptPanel.addPropertyChangeListener(handler); + this.repaint(); } - - /** - * This method returns the Button where you can get - * all individuals of the old concept. - * @return JButton - */ - public JButton getAllPositiveindividuals() { - return allPositiveIndividuals; - } - - /** - * This method returns the Button where you can get - * all individuals of the new concept. - * @return JButton - */ - public JButton getAllNegativeIndividuals() { - return allNegativeIndividuals; - } + private void unsetEverything() { removeAll(); } /** * This method sets the Informations of the selected description. */ - private void setInformation() { + public void setInformation() { ontologiesStrings = model.getOntologyURIString(); if(eval!=null) { //sets the accuracy of the selected concept @@ -283,5 +149,37 @@ double acc = ((EvaluatedDescriptionClass) eval).getAccuracy()*100; accuracyText.setText(String.valueOf(acc)+"%"); } + accuracy.setVisible(true); + accuracyText.setVisible(true); + concept.setVisible(true); + conceptText.setVisible(true); } - } + + + public GraphicalCoveragePanel getGraphicalCoveragePanel() { + return p; + } + public JPanel getConceptPanel() { + return conceptPanel; + } + public void unsetPanel() { + unsetEverything(); + conceptPanel.removeAll(); + accuracy.setVisible(false); + accuracyText.setVisible(false); + concept.setVisible(false); + conceptText.setVisible(false); + if(p != null) { + p.unsetPanel(); + } + conceptPanel.add(concept); + conceptPanel.add(accuracy); + conceptPanel.add(conceptText); + conceptPanel.add(accuracyText); + conceptPanel.setVisible(false); + this.add(conceptPanel); + + repaint(); + } + +} \ No newline at end of file Deleted: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -1,102 +0,0 @@ -/** - * Copyright (C) 2007-2009, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.tools.protege; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Set; -import java.util.SortedSet; - -import javax.swing.JOptionPane; - -import org.dllearner.algorithms.EvaluatedDescriptionClass; -import org.dllearner.core.EvaluatedDescription; -import org.dllearner.core.owl.Individual; - -/** - * This class takes care of all events happening in the MoreDetailForSuggestedConceptsPanelHandler. - * @author Christian Koetteritzsch - * - */ -public class MoreDetailForSuggestedConceptsPanelHandler implements ActionListener{ - - private static final String OLD_BUTTON_LABEL = "old"; - private static final String NEW_BUTTON_LABEL = "new"; - private final DLLearnerModel model; - private EvaluatedDescription eval; - - /** - * This is the constructor of the MoreDetailForSuggestedConceptsPanelHandler. - * @param m Model of the DL-Learner - */ - public MoreDetailForSuggestedConceptsPanelHandler(DLLearnerModel m) { - model = m; - } - - @Override - public void actionPerformed(ActionEvent a) { - if(a.getActionCommand().equals(OLD_BUTTON_LABEL)) { - String toolTip = "This are the Individuals beloning to " + model.getOldConceptOWLAPI() +":\n\n"; - SortedSet<Individual> ind = model.getReasoner().getIndividuals(model.getCurrentConcept()); - for(Individual i : ind) { - Set<String> ur = model.getOntologyURIString(); - for(String str : ur) { - if(i.toString().contains(str)) { - toolTip = toolTip + i.toManchesterSyntaxString(str, null) + "\n"; - } - } - } - JOptionPane.showMessageDialog(null, toolTip); - } - - if(a.getActionCommand().equals(NEW_BUTTON_LABEL)) { - Set<Individual> posInd = ((EvaluatedDescriptionClass) eval).getCoveredInstances(); - posInd.addAll(((EvaluatedDescriptionClass) eval).getAdditionalInstances()); - Set<String> uri = model.getOntologyURIString(); - String toolTip = "This are the Individuals beloning to\n "; - for(String u : uri) { - if(eval.getDescription().toString().contains(u)) { - toolTip = toolTip + eval.getDescription().toManchesterSyntaxString(u, null) + ":\n\n"; - } - } - - for(Individual ind : posInd) { - - for(String u : uri) { - if(ind.toString().contains(u)) { - toolTip = toolTip + ind.toManchesterSyntaxString(u, null) + "\n"; - } - } - - } - JOptionPane.showMessageDialog(null, toolTip); - - } - - } - - /** - * This method sets the currently selected evaluated description. - * @param e evaluated description - */ - public void setEvaluadtedDescription(EvaluatedDescription e) { - eval = e; - } -} Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -110,9 +110,4 @@ return nrOfConcepts.getValue(); } - public void resetOptions() { - minAccuracy.setValue(90); - maxExecutionTime.setValue(5); - nrOfConcepts.setValue(10); - } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -41,6 +41,7 @@ @Override public JComponent getComponent() { + //super.getOWLEditorKit().getOWLWorkspace().getOWLComponentFactory().getOWLClassDescriptionEditor(null).getEditorComponent().setSize(new Dimension(1024, 768)); return view.getLearnerView(); } @@ -52,6 +53,7 @@ @Override public boolean isValidInput() { view.makeView(); + view.getMoreDetailForSuggestedConceptsPanel().unsetPanel(); return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |