Skip to content

Commit

Permalink
Merge pull request #57 from UCSDOalads/develop
Browse files Browse the repository at this point in the history
Release v0.3
  • Loading branch information
UltimatePea authored Mar 30, 2017
2 parents 2b612f7 + ff8bff1 commit ea6006a
Show file tree
Hide file tree
Showing 117 changed files with 6,702 additions and 166 deletions.
1 change: 1 addition & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin"/>
</classpath>
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
*.class
/bin/
.DS_Store
.settings
.settings/*
11 changes: 0 additions & 11 deletions .settings/org.eclipse.jdt.core.prefs

This file was deleted.

11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: java
jdk:
- oraclejdk8

before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start

notifications:
email: false
18 changes: 18 additions & 0 deletions TODOList.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
1. File Save/Close Operations
2. Edit Undo/Redo Operations
//3. More usable SelectTools
//4. Remove Functinoality
//5. Zooming and Scrolling and Moving Function
6. Data Point Connection Types
7. Available Class Search
8. Auto-Update Display Box Affected by Recent Changes
9. Debug Undo Function
10. Type Cast try (String) catch



1. File Save
2. ClassSearch
11. Display history
12.
13.
6 changes: 0 additions & 6 deletions bin/.gitignore

This file was deleted.

42 changes: 42 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<project name="JavaSketchPad" default="run" basedir=".">
<property name="build.dir" location="ant_build" />
<property name="src.dir" location="src" />

<target name="init" description="Creating directory">
<mkdir dir="${build.dir}" />
</target>

<target name="compile" depends="init" description="Compiling Sources">
<javac srcdir="${src.dir}" destdir="${build.dir}" includeantruntime="false">
<classpath refid="classpath.test" />
</javac>
</target>

<target name="run" depends="compile" description="Running the program">
</target>

<target name="clean">
<delete dir="${build.dir}" />
</target>


<path id="classpath.test">
<pathelement location="lib/junit-4.12.jar" />
<pathelement location="lib/hamcrest-core-1.3.jar" />
<pathelement location="${build.dir}" />
</path>


<target name="test" depends="compile">
<junit printsummary="on" haltonfailure="yes" fork="true">
<classpath>
<path refid="classpath.test" />
<pathelement location="${test.build.dir}" />
</classpath>
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${src.dir}" includes="**/*Test.java" />
</batchtest>
</junit>
</target>
</project>
Binary file added lib/hamcrest-core-1.3.jar
Binary file not shown.
Binary file added lib/junit-4.12.jar
Binary file not shown.
53 changes: 53 additions & 0 deletions src/actions/AddAnnotationAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package actions;

import java.util.ArrayList;

import javax.swing.JOptionPane;

import actions.menu.ActionsMenuBarTitles;
import actions.singleinstanceoperations.SingleInstanceOperation;
import paintcomponents.PaintComponent;
import paintcomponents.annotations.TextAnnotation;
import paintcomponents.data.DataTextPaintComponent;
import ui.PaintPanel;

/**
* add the annotation to a component
*
* @author muchi
*
*/
public class AddAnnotationAction extends SingleInstanceOperation<PaintComponent>{

/**
* ctor
* @param panel the panel
*/
public AddAnnotationAction(PaintPanel panel) {
super(panel);
}

/**
* @return the location of the button
*/
@Override
public String locationString() {
return ActionsMenuBarTitles.Data().Annotations().Add().toString();
}

@Override
protected void performActionOnInstance(PaintComponent instance) {
// TODO Auto-generated method stub
String annotations = JOptionPane
.showInputDialog("Please specify the annotation of the component");
new TextAnnotation(instance, annotations);

}

@Override
protected Class<PaintComponent> getGenericClassType() {
return PaintComponent.class;
}


}
30 changes: 30 additions & 0 deletions src/actions/AddDataDisplayBoxAction.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package actions;

import actions.edit.undoredo.SharedUndoRedoActionManager;
import actions.edit.undoredo.UndoRedoableInterface;
import actions.menu.ActionsMenuBarTitles;
import paintcomponents.data.DataDisplayPaintComponent;
import ui.PaintPanel;
Expand All @@ -19,6 +21,34 @@ public boolean canPerformAction() {
public void performAction() {
DataDisplayPaintComponent comp = new DataDisplayPaintComponent("Data Display", panel.getWidth() /2, panel.getHeight()/2);
panel.addPaintComponent(comp);

//push action to manager
SharedUndoRedoActionManager.getSharedInstance().pushUndoableAction(new UndoRedoableInterface() {

@Override
public void undoAction() {
comp.remove(panel);
panel.repaint();
}

@Override
public void redoAction() {
panel.addPaintComponent(comp);
panel.repaint();
}

@Override
protected String commandName() {
return "add data displayBox";
}

@Override
protected String commandDescription() {
return "add a string display";
}


});
panel.repaint();
}

Expand Down
32 changes: 31 additions & 1 deletion src/actions/AddDataInputBoxAction.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package actions;

import actions.edit.undoredo.SharedUndoRedoActionManager;
import actions.edit.undoredo.UndoRedoableInterface;
import actions.menu.ActionsMenuBarTitles;
import paintcomponents.data.DataInputTextfieldPaintComponent;
import ui.PaintPanel;
Expand All @@ -19,8 +21,36 @@ public boolean canPerformAction() {
public void performAction() {
DataInputTextfieldPaintComponent comp = new DataInputTextfieldPaintComponent("Data Input", panel.getWidth() /2, panel.getHeight()/2);
panel.addPaintComponent(comp);


//push action to the manager
SharedUndoRedoActionManager.getSharedInstance().pushUndoableAction(new UndoRedoableInterface() {

@Override
public void undoAction() {
comp.remove(panel);
panel.repaint();
}

@Override
public void redoAction() {
panel.addPaintComponent(comp);
panel.repaint();

}

@Override
protected String commandName() {
return "add data inputBox";
}

@Override
protected String commandDescription() {
// TODO Auto-generated method stub
return "add a string input";
}
});
panel.repaint();

}

@Override
Expand Down
37 changes: 37 additions & 0 deletions src/actions/AddHaskellComponent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package actions;

import javax.swing.JOptionPane;

import actions.menu.ActionsMenuBarTitles;
import paintcomponents.haskell.HaskellExpressionPaintComponent;
import ui.PaintPanel;

public class AddHaskellComponent extends PaintAction {

public AddHaskellComponent(PaintPanel panel) {
super(panel);
}

@Override
public boolean canPerformAction() {
return true;
}

@Override
public void performAction() {
String expr = JOptionPane
.showInputDialog("Please enter the haskell expression");
panel.addPaintComponent(new HaskellExpressionPaintComponent(
expr, panel.getWidth() / 2, panel.getHeight() / 2));

panel.repaint();

}

@Override
public String locationString() {
return ActionsMenuBarTitles.Developer("Haskell/Add Haskell Expression")
.toString();
}

}
30 changes: 30 additions & 0 deletions src/actions/AddHaskellEvaluatorComponentAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package actions;

import actions.menu.ActionsMenuBarTitles;
import paintcomponents.haskell.EvaluateHaskellPaintComponent;
import ui.PaintPanel;

public class AddHaskellEvaluatorComponentAction extends PaintAction {

public AddHaskellEvaluatorComponentAction(PaintPanel panel) {
super(panel);
}

@Override
public boolean canPerformAction() {
return true;
}

@Override
public void performAction() {
EvaluateHaskellPaintComponent comp = new EvaluateHaskellPaintComponent("Use Data Display/Update to compute expression result", panel.getWidth() /2, panel.getHeight()/2);
panel.addPaintComponent(comp);
panel.repaint();
}

@Override
public String locationString() {
return ActionsMenuBarTitles.Developer("Haskell/Add Evaluator").toString();
}

}
63 changes: 63 additions & 0 deletions src/actions/AddInstanceMethodAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package actions;

import ui.PaintPanel;

import java.lang.reflect.Method;

import javax.swing.JOptionPane;

import actions.menu.ActionsMenuBarTitles;
import paintcomponents.java.lazy.ClassPaintComponent;
import paintcomponents.java.interactive.InstanceOperationComponent;
import paintcomponents.java.lazy.MethodPaintComponent;

public class AddInstanceMethodAction extends PaintAction {

public AddInstanceMethodAction(PaintPanel panel) {
super(panel);
}

@Override
public boolean canPerformAction() {
if (panel.getSelectTool().getSelectedComponents().size() != 1) {
return false;
}
if (panel.getSelectTool().getSelectedComponents()
.get(0) instanceof InstanceOperationComponent) {
return true;
}
return false;
}

@Override
public void performAction() {
InstanceOperationComponent insComp =
(InstanceOperationComponent)panel.getSelectTool().
getSelectedComponents().get(0);
Method[] methods = insComp.getDisplayingClass().getMethods();

int desiaredConstructorIndex = Integer
.parseInt(JOptionPane.showInputDialog(
"Please enter the index of the constructor you would like to use: \n\n\n"
+ getMethodsSelectionUI(methods)));
insComp.addMethodPaintComponent(methods[desiaredConstructorIndex], panel);
panel.repaint();
}

@Override
public String locationString() {
// TODO Auto-generated method stub
return ActionsMenuBarTitles.Lazy().Add().Add_Instance_Method().toString();
}

public String getMethodsSelectionUI(Method[] methods) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < methods.length; i++) {
Method constructor = methods[i];
builder.append(i + " : " + constructor.toString() + "\n");
}
return builder.toString();

}

}
Loading

0 comments on commit ea6006a

Please sign in to comment.