forked from tesseract-ocr/tesseract
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removing lua dependency from java code
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@243 d0cd1f9f-072b-0410-8dd7-cf729c803f20
- Loading branch information
theraysmith
committed
Jun 2, 2009
1 parent
254b936
commit c82051a
Showing
8 changed files
with
458 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
SUBDIRS = | ||
|
||
EXTRA_DIST = \ | ||
test.lua makefile SVEvent.java SVEventHandler.java \ | ||
test.lua makefile SVAbstractMenuItem.java \ | ||
SVCheckboxMenuItem.java SVEmptyMenuItem.java \ | ||
SVEvent.java SVEventHandler.java \ | ||
SVEventType.java SVImageHandler.java SVMenuBar.java \ | ||
SVMenuItem.java SVPopupMenu.java SVWindow.java \ | ||
SVMenuItem.java SVPopupMenu.java SVSubMenuItem.java SVWindow.java \ | ||
ScrollView.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright 2007 Google Inc. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); You may not | ||
// use this file except in compliance with the License. You may obtain a copy of | ||
// the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by | ||
// applicable law or agreed to in writing, software distributed under the | ||
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS | ||
// OF ANY KIND, either express or implied. See the License for the specific | ||
// language governing permissions and limitations under the License. | ||
|
||
package com.google.scrollview.ui; | ||
|
||
/** | ||
* A MenuListItem is any sort of menu entry. This can either be within a popup | ||
* menu or within a menubar. It can either be a submenu (only name and | ||
* command-id) or a name with an associated value and possibly description. They | ||
* can also have new entries added (if they are submenus). | ||
* | ||
* @author wanke@google.com | ||
*/ | ||
|
||
import com.google.scrollview.events.SVEventType; | ||
|
||
import javax.swing.JMenu; | ||
import javax.swing.JMenuItem; | ||
|
||
abstract class SVAbstractMenuItem { | ||
JMenuItem mi; | ||
public String name; | ||
public int id; | ||
|
||
/** | ||
* Sets the basic attributes for name, id and the corresponding swing item | ||
*/ | ||
SVAbstractMenuItem(int id, String name, JMenuItem jmi) { | ||
this.mi = jmi; | ||
this.name = name; | ||
this.id = id; | ||
} | ||
|
||
/** Returns the actual value of the MenuListItem. */ | ||
public String getValue() { return null; } | ||
|
||
/** Adds a child entry to the submenu. */ | ||
public void add(SVAbstractMenuItem mli) { } | ||
|
||
/** Adds a child menu to the submenu (or root node). */ | ||
public void add(JMenu jli) { } | ||
|
||
/** | ||
* What to do when user clicks on this item. | ||
* @param window The window the event happened. | ||
* @param eventType What kind of event will be associated | ||
* (usually SVET_POPUP or SVET_MENU). | ||
*/ | ||
public void performAction(SVWindow window, SVEventType eventType) {} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright 2007 Google Inc. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); You may not | ||
// use this file except in compliance with the License. You may obtain a copy of | ||
// the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by | ||
// applicable law or agreed to in writing, software distributed under the | ||
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS | ||
// OF ANY KIND, either express or implied. See the License for the specific | ||
// language governing permissions and limitations under the License. | ||
|
||
package com.google.scrollview.ui; | ||
|
||
/** | ||
* A MenuListItem is any sort of menu entry. This can either be within a popup | ||
* menu or within a menubar. It can either be a submenu (only name and | ||
* command-id) or a name with an associated value and possibly description. They | ||
* can also have new entries added (if they are submenus). | ||
* | ||
* @author wanke@google.com | ||
*/ | ||
|
||
import com.google.scrollview.ScrollView; | ||
import com.google.scrollview.events.SVEvent; | ||
import com.google.scrollview.events.SVEventType; | ||
|
||
import javax.swing.JCheckBoxMenuItem; | ||
|
||
/** | ||
* Constructs a new menulistitem which possesses a flag that can be toggled. | ||
*/ | ||
class SVCheckboxMenuItem extends SVAbstractMenuItem { | ||
public String value = null; | ||
public String desc = null; | ||
public boolean bvalue; | ||
|
||
SVCheckboxMenuItem(int id, String name, boolean val) { | ||
super(id, name, new JCheckBoxMenuItem(name, val)); | ||
bvalue = val; | ||
} | ||
|
||
/** What to do when user clicks on this item. */ | ||
@Override | ||
public void performAction(SVWindow window, SVEventType eventType) { | ||
// Checkbox entry - trigger and send event. | ||
if (bvalue) { | ||
bvalue = false; | ||
} else { | ||
bvalue = true; | ||
} | ||
SVEvent svme = new SVEvent(eventType, window, id, getValue()); | ||
ScrollView.addMessage(svme); | ||
} | ||
|
||
/** Returns the actual value of the MenuListItem. */ | ||
@Override | ||
public String getValue() { | ||
return Boolean.toString(bvalue); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2007 Google Inc. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); You may not | ||
// use this file except in compliance with the License. You may obtain a copy of | ||
// the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by | ||
// applicable law or agreed to in writing, software distributed under the | ||
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS | ||
// OF ANY KIND, either express or implied. See the License for the specific | ||
// language governing permissions and limitations under the License. | ||
|
||
package com.google.scrollview.ui; | ||
|
||
/** | ||
* A MenuListItem is any sort of menu entry. This can either be within a popup | ||
* menu or within a menubar. It can either be a submenu (only name and | ||
* command-id) or a name with an associated value and possibly description. They | ||
* can also have new entries added (if they are submenus). | ||
* | ||
* @author wanke@google.com | ||
*/ | ||
|
||
import com.google.scrollview.ScrollView; | ||
import com.google.scrollview.events.SVEvent; | ||
import com.google.scrollview.events.SVEventType; | ||
|
||
import javax.swing.JMenuItem; | ||
|
||
/** | ||
* Constructs a new menulistitem which just has an ID and a name attached to | ||
* it. In this case, we will have to ask for the value of the item and its | ||
* description if it gets called. | ||
*/ | ||
class SVEmptyMenuItem extends SVAbstractMenuItem { | ||
SVEmptyMenuItem(int id, String name) { | ||
super(id, name, new JMenuItem(name)); | ||
} | ||
/** What to do when user clicks on this item. */ | ||
@Override | ||
public void performAction(SVWindow window, SVEventType eventType) { | ||
// Send an event indicating that someone clicked on an entry. | ||
// Value will be null here. | ||
SVEvent svme = | ||
new SVEvent(eventType, window, id, getValue()); | ||
ScrollView.addMessage(svme); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2007 Google Inc. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); You may not | ||
// use this file except in compliance with the License. You may obtain a copy of | ||
// the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by | ||
// applicable law or agreed to in writing, software distributed under the | ||
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS | ||
// OF ANY KIND, either express or implied. See the License for the specific | ||
// language governing permissions and limitations under the License. | ||
|
||
package com.google.scrollview.ui; | ||
|
||
/** | ||
* A MenuListItem is any sort of menu entry. This can either be within a popup | ||
* menu or within a menubar. It can either be a submenu (only name and | ||
* command-id) or a name with an associated value and possibly description. They | ||
* can also have new entries added (if they are submenus). | ||
* | ||
* @author wanke@google.com | ||
*/ | ||
|
||
import javax.swing.JMenu; | ||
|
||
/** Constructs a new submenu which can hold other entries. */ | ||
class SVSubMenuItem extends SVAbstractMenuItem { | ||
public SVSubMenuItem(String name, JMenu jli) { | ||
super(-1, name, jli); | ||
} | ||
/** Adds a child entry to the submenu. */ | ||
@Override | ||
public void add(SVAbstractMenuItem mli) { | ||
mi.add(mli.mi); | ||
} | ||
/** Adds a child menu to the submenu (or root node). */ | ||
@Override | ||
public void add(JMenu jli) { | ||
mi.add(jli); | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.