Search in sources :

Example 6 with PropertyTableRowTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject in project convertigo by convertigo.

the class TreeObjectSorter method compare.

@Override
public int compare(Viewer viewer, Object e1, Object e2) {
    if ((e1 instanceof DatabaseObjectTreeObject) && (e2 instanceof DatabaseObjectTreeObject)) {
        DatabaseObject d1 = ((DatabaseObjectTreeObject) e1).getObject();
        DatabaseObject d2 = ((DatabaseObjectTreeObject) e2).getObject();
        DatabaseObjectTreeObject p1 = ((DatabaseObjectTreeObject) e1).getOwnerDatabaseObjectTreeObject();
        DatabaseObjectTreeObject p2 = ((DatabaseObjectTreeObject) e2).getOwnerDatabaseObjectTreeObject();
        if (p1.equals(p2)) {
            DatabaseObject p = (DatabaseObject) p1.getObject();
            try {
                Object o1 = p.getOrder(d1);
                Object o2 = p.getOrder(d2);
                if ((o1 instanceof Long) && (o2 instanceof Long)) {
                    long l1 = ((Long) o1).longValue();
                    long l2 = ((Long) o2).longValue();
                    int dp = (int) (l1 - l2);
                    if (dp != 0)
                        return dp;
                }
            } catch (EngineException e) {
                ConvertigoPlugin.logException(e, "Error while sorting objects \"" + d1.getQName() + "\" and \"" + d2.getQName() + "\" in Tree.");
            }
        }
    } else if ((e1 instanceof PropertyTableRowTreeObject) && (e2 instanceof PropertyTableRowTreeObject)) {
        PropertyTableRowTreeObject r1 = (PropertyTableRowTreeObject) e1;
        PropertyTableRowTreeObject r2 = (PropertyTableRowTreeObject) e2;
        int i1 = r1.getParent().indexOf(r1);
        int i2 = r2.getParent().indexOf(r2);
        return i1 - i2;
    } else if ((e1 instanceof PropertyTableColumnTreeObject) && (e2 instanceof PropertyTableColumnTreeObject)) {
        PropertyTableColumnTreeObject c1 = (PropertyTableColumnTreeObject) e1;
        PropertyTableColumnTreeObject c2 = (PropertyTableColumnTreeObject) e2;
        int i1 = c1.getParent().indexOf(c1);
        int i2 = c2.getParent().indexOf(c2);
        return i1 - i2;
    } else if ((e1 instanceof ObjectsFolderTreeObject) && !(e2 instanceof ObjectsFolderTreeObject)) {
        return -1;
    } else if (!(e1 instanceof ObjectsFolderTreeObject) && (e2 instanceof ObjectsFolderTreeObject)) {
        return 1;
    }
    return super.compare(viewer, e1, e2);
}
Also used : PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) EngineException(com.twinsoft.convertigo.engine.EngineException) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject)

Example 7 with PropertyTableRowTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject in project convertigo by convertigo.

the class DatabaseObjectDecreasePriorityAction method decreasePriority.

private void decreasePriority(TreeObject treeObject) throws EngineException {
    int count = counter;
    if (treeObject instanceof DatabaseObjectTreeObject) {
        DatabaseObject databaseObject = (DatabaseObject) treeObject.getObject();
        DatabaseObject parent = databaseObject.getParent();
        if (parent != null && parent instanceof IContainerOrdered) {
            IContainerOrdered containerOrdered = (IContainerOrdered) parent;
            while (count-- > 0) {
                containerOrdered.decreasePriority(databaseObject);
            }
            if (parent.hasChanged) {
                DatabaseObjectTreeObject parentTreeObject = null;
                TreeParent treeParent = treeObject.getParent();
                if (treeParent instanceof FolderTreeObject) {
                    parentTreeObject = (DatabaseObjectTreeObject) treeParent.getParent();
                } else {
                    parentTreeObject = (DatabaseObjectTreeObject) treeParent;
                }
                if (!treeNodesToUpdate.contains(parentTreeObject)) {
                    treeNodesToUpdate.add(parentTreeObject);
                }
            }
        }
    } else {
        DatabaseObjectTreeObject databaseObjectTreeObject = null;
        if (treeObject instanceof PropertyTableRowTreeObject) {
            PropertyTableTreeObject propertyTableTreeObject = (PropertyTableTreeObject) treeObject.getParent();
            while (count-- > 0) {
                if ((treeObject = propertyTableTreeObject.moveRow((PropertyTableRowTreeObject) treeObject, false)) != null) {
                    databaseObjectTreeObject = (DatabaseObjectTreeObject) propertyTableTreeObject.getParent();
                }
            }
        } else if (treeObject instanceof PropertyTableColumnTreeObject) {
            PropertyTableRowTreeObject propertyTableRowTreeObject = (PropertyTableRowTreeObject) treeObject.getParent();
            PropertyTableTreeObject propertyTableTreeObject = (PropertyTableTreeObject) propertyTableRowTreeObject.getParent();
            while (count-- > 0) {
                if ((treeObject = propertyTableRowTreeObject.moveColumn((PropertyTableColumnTreeObject) treeObject, false)) != null) {
                    databaseObjectTreeObject = (DatabaseObjectTreeObject) propertyTableTreeObject.getParent();
                }
            }
        }
        if (databaseObjectTreeObject != null) {
            if (databaseObjectTreeObject.hasChanged()) {
                DatabaseObjectTreeObject parentTreeObject = null;
                TreeParent treeParent = databaseObjectTreeObject.getParent();
                if (treeParent instanceof FolderTreeObject)
                    parentTreeObject = (DatabaseObjectTreeObject) treeParent.getParent();
                else
                    parentTreeObject = (DatabaseObjectTreeObject) treeParent;
                if (!treeNodesToUpdate.contains(parentTreeObject)) {
                    treeNodesToUpdate.add(parentTreeObject);
                }
            }
        }
    }
}
Also used : PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) IContainerOrdered(com.twinsoft.convertigo.beans.core.IContainerOrdered) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)

Example 8 with PropertyTableRowTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject in project convertigo by convertigo.

the class CreatePropertyTableColumnAction method selectionChanged.

public void selectionChanged(IAction action, ISelection selection) {
    super.selectionChanged(action, selection);
    IStructuredSelection structuredSelection = (IStructuredSelection) selection;
    TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
    if (treeObject instanceof PropertyTableRowTreeObject) {
        action.setText(((PropertyTableRowTreeObject) treeObject).getColumnDefaultLabel());
    }
}
Also used : PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 9 with PropertyTableRowTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject in project convertigo by convertigo.

the class CreatePropertyTableColumnAction method run.

public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = getParentShell();
    shell.setCursor(waitCursor);
    try {
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            PropertyTableRowTreeObject propertyTableRowTreeObject = (PropertyTableRowTreeObject) explorerView.getFirstSelectedTreeObject();
            TreeParent owner = propertyTableRowTreeObject.getTreeObjectOwner();
            IPropertyTreeObject pto = propertyTableRowTreeObject.addNewColumn();
            if (owner instanceof DatabaseObjectTreeObject) {
                DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) owner;
                if (databaseObjectTreeObject.hasChanged()) {
                    TreeParent treeParent = databaseObjectTreeObject.getParent();
                    if (treeParent instanceof FolderTreeObject)
                        treeParent = treeParent.getParent();
                    // explorerView.reloadTreeObject(treeParent);
                    explorerView.objectChanged(new CompositeEvent(treeParent.getObject(), pto.getPath()));
                }
            } else
                explorerView.refreshTreeObject(owner, true);
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to create a new column!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) Cursor(org.eclipse.swt.graphics.Cursor) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent) Display(org.eclipse.swt.widgets.Display) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject)

Example 10 with PropertyTableRowTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject in project convertigo by convertigo.

the class ViewImageProvider method getImageData.

/**
 * Dispose all loaded images
 */
/*public static void dispose() {
		String imageName = null;
		Image image = null;
		for (Enumeration e = imagesCache.keys(); e.hasMoreElements(); ) {
			imageName = (String) e.nextElement();
			if (imageName != null) {
				image = (Image) imagesCache.get(imageName);
				imagesCache.put(imageName, null);
			}
			if (image != null)
				image.dispose();
		}
	}*/
private static ImageData getImageData(Image image, Object object) {
    ImageData imageData = image.getImageData();
    DatabaseObjectTreeObject databaseObjectTreeObject = null;
    if (object instanceof DatabaseObjectTreeObject) {
        databaseObjectTreeObject = (DatabaseObjectTreeObject) object;
    } else if (object instanceof PropertyTableTreeObject) {
        PropertyTableTreeObject table = (PropertyTableTreeObject) object;
        if (table != null) {
            databaseObjectTreeObject = (DatabaseObjectTreeObject) table.getTreeObjectOwner();
        }
    } else if (object instanceof PropertyTableRowTreeObject) {
        PropertyTableTreeObject table = ((PropertyTableRowTreeObject) object).getParentTable();
        if (table != null) {
            databaseObjectTreeObject = (DatabaseObjectTreeObject) table.getTreeObjectOwner();
        }
    } else if (object instanceof PropertyTableColumnTreeObject) {
        PropertyTableTreeObject table = ((PropertyTableColumnTreeObject) object).getParentTable();
        if (table != null) {
            databaseObjectTreeObject = (DatabaseObjectTreeObject) table.getTreeObjectOwner();
        }
    } else if (object instanceof FolderTreeObject) {
        FolderTreeObject t_folder = (FolderTreeObject) object;
        if (t_folder.getParent() instanceof DatabaseObjectTreeObject) {
            databaseObjectTreeObject = (DatabaseObjectTreeObject) t_folder.getParent();
        }
    } else if (object instanceof DesignDocumentViewTreeObject) {
        DesignDocumentViewTreeObject ddvto = (DesignDocumentViewTreeObject) object;
        if (ddvto != null) {
            databaseObjectTreeObject = (DatabaseObjectTreeObject) ddvto.getTreeObjectOwner();
        }
    } else if (object instanceof DesignDocumentFunctionTreeObject) {
        DesignDocumentFunctionTreeObject ddfto = (DesignDocumentFunctionTreeObject) object;
        if (ddfto != null) {
            databaseObjectTreeObject = (DatabaseObjectTreeObject) ddfto.getTreeObjectOwner();
        }
    }
    if (databaseObjectTreeObject != null) {
        // GIF style
        if (imageData.palette.colors != null) {
            for (int i = 0; i < imageData.palette.colors.length; i++) {
                if (i != imageData.transparentPixel) {
                    RGB rgb = imageData.palette.colors[i];
                    imageData.palette.colors[i] = changeHue(rgb, databaseObjectTreeObject);
                }
            }
        } else // PNG style and Linux
        {
            for (int i = 0; i < imageData.height; i++) {
                for (int j = 0; j < imageData.width; j++) {
                    RGB rgb = imageData.palette.getRGB(imageData.getPixel(j, i));
                    imageData.setPixel(j, i, imageData.palette.getPixel(changeHue(rgb, databaseObjectTreeObject)));
                }
            }
        }
    }
    return imageData;
}
Also used : PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ImageData(org.eclipse.swt.graphics.ImageData) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) RGB(org.eclipse.swt.graphics.RGB) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)

Aggregations

DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)11 PropertyTableRowTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject)11 FolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject)9 PropertyTableColumnTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject)7 PropertyTableTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)7 TreeParent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent)6 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)5 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)5 IPropertyTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject)4 Shell (org.eclipse.swt.widgets.Shell)4 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)3 DesignDocumentFunctionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject)3 ObjectsFolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject)3 UnloadedProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject)3 Cursor (org.eclipse.swt.graphics.Cursor)3 Display (org.eclipse.swt.widgets.Display)3 IContainerOrdered (com.twinsoft.convertigo.beans.core.IContainerOrdered)2 CompositeEvent (com.twinsoft.convertigo.eclipse.editors.CompositeEvent)2 DesignDocumentViewTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject)2 MobileUIComponentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject)2