import ie.dcu.apps.ist.dialogs.ExportDialog;
import ie.dcu.apps.ist.export.imagemap.*;
+import ie.dcu.apps.ist.views.*;
import ie.dcu.segment.*;
import ie.dcu.swt.ImageConverter;
*
* @author Kevin McGuinness
*/
-public class ExportImageMapAction extends AppAction {
+public class ExportImageMapAction extends AppAction{
public ExportImageMapAction(ActionManager m) {
super(m);
exporter.setObjectLink(result.link);
exporter.setExportShape(result.shape);
exporter.setObjectDescription(result.description);
+ String label = SegmentationView.comboLabel.getText();
+ if(label.indexOf('{') != -1)
+ {
+ label = label.substring(0,label.indexOf('{')-1);
+ }
+ exporter.setTitle(label);
// Export
try {
handleError(e);
return;
}
-
+ // for opening the image after saving as ImageMap
if (result.open) {
File file = new File(result.folder, result.html);
Program program = Program.findProgram(".html");
private String imageName = "image";
private String objectDescription = "";
private String objectLink = "";
+ private String title = "";
private AreaShape exportShape = AreaShape.Polygon;
public Exporter(BufferedImage image, SegmentationMask mask) {
this.imageName = imageName;
}
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
public String getObjectDescription() {
return objectDescription;
}
imageName, idx++));
area.addAttr("onmouseout",
String.format("rollover(document.%s, image0)", imageName));
+ area.addAttr("title",getTitle());
}
map.addArea(area);
private String href;
private String alt;
- private String title;
private AreaShape shape;
private int[] coords;
private final Map<String, String> attrs;
public MapArea() {
href = "";
alt = "";
- title = "";
shape = AreaShape.Polygon;
coords = new int[0];
attrs = new HashMap<String, String>();
return alt;
}
- public void setTitle(String alt) {
- this.title = title == null ? "" : title;
- }
-
- public String getTitle() {
- return title;
- }
-
public void setAlt(String alt) {
this.alt = alt == null ? "" : alt;
}
tag
.attr("href", encodedHREF)
.attr("alt", alt)
- .attr("title", getTitle())
.attr("shape", shape.toString())
.attr("coords", getCoordsString());
private boolean auto = true;
// Combo box housing the selectable views
- private Combo combo, comboLabel;
+ private Combo combo;
+
+ public static Combo comboLabel;
// Current segmentation tool
private Segmenter segmenter;
public void keyReleased(KeyEvent e) {
comboLabel.remove(0,comboLabel.getItemCount()-1);
setLabel(comboLabel.getText());
- Display.getCurrent().asyncExec(new Runnable() {
+ Display.getCurrent().asyncExec(new Runnable() {
public void run() {
comboLabel.setText(comboLabel.getText());
comboLabel.forceFocus();
item.setControl(assign);
assign.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent arg0) {
- System.out.println("selected"+comboLabel.getText());
+ String lab = null;
+ if(comboLabel.getText().indexOf('{') != -1)
+ {
+ lab = comboLabel.getText().substring(0,comboLabel.getText().indexOf('{')-1);
+ }
+ else
+ {
+ lab = comboLabel.getText();
+ }
+ System.out.println("selected"+lab);
}
-
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
Tool.ZoomOut.action.setEnabled(canZoomOut());
Tool.ZoomOriginal.action.setEnabled(canZoomOriginal());
Tool.ZoomBestFit.action.setEnabled(canZoomBestFit());
+ comboLabel.setEnabled(canZoomBestFit());
+ assign.setEnabled(canZoomBestFit() & !(comboLabel.getText().isEmpty()));
Tool.Foreground.action.setChecked(isAnnotatingForeground());
Tool.Background.action.setChecked(isAnnotatingBackground());
Tool.Clear.action.setEnabled(canClear());
}
-
private void setPainter() {
SegmentationPainter painter = painters.get(combo.getText());
setPainter(painter);
private void setLabel(String content) {
try
{
- System.out.println("Content coming as"+content);
- URL url = new URL("http://palea.cgrb.oregonstate.edu/services/PO_web_service.php?request_type=term_search&search_value="+content+"&inc_synonyms&branch_filter=plant_anatomy&max=20");
+ String content1 = URLEncoder.encode(content.toString(),"UTF-8");
+ URL url = new URL("http://palea.cgrb.oregonstate.edu/services/PO_web_service.php?request_type=term_search&search_value="+content1+"&inc_synonyms&branch_filter=plant_anatomy&max=20");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
if(connection.getResponseCode() == 200)
{
String inputLine;
JSONObject object = null;
while ((inputLine = in.readLine()) != null)
{
- System.out.println("Response coming as"+inputLine);
- object = new JSONObject(inputLine);
+ object = new JSONObject(inputLine);
}
JSONArray array = new JSONArray(object.getString("PO_term_search_response"));
String listElement;
catch(Exception ex)
{
}
+ assign.setEnabled(!(comboLabel.getText().isEmpty()));
}
private void apply() {