use of com.ramussoft.pb.DataPlugin in project ramus by Vitaliy-Yakovchuk.
the class External method paint.
@Override
public void paint(Graphics2D g) {
DataPlugin dp = ((NFunction) function).getDataPlugin();
Row row = dp.findRowByGlobalId(function.getLink());
final class PolygonD extends Polygon {
/**
*/
private static final long serialVersionUID = 113232131232134523L;
public void addPoint(final double x, final double y) {
super.addPoint((int) x, (int) y);
}
}
g.setColor(function.getBackground());
final Rectangle2D rect = movingArea.getBounds(getBounds());
g.fill(rect);
g.setFont(function.getFont());
paintText(g);
if (row != null) {
String string = row.getKod();
movingArea.paintText(g, string, new FRectangle(myBounds.getX() + 3, myBounds.getY() + 3, myBounds.getWidth() - 3, myBounds.getHeight() - 3), Line.LEFT_ALIGN, 0, true);
}
paintBorder(g);
final Stroke tmp = g.getStroke();
g.draw(rect);
double zm = movingArea.getIDoubleOrdinate(2);
g.draw(new Line2D.Double(rect.getX() + zm, rect.getY() + zm, rect.getX() + zm, rect.getY() + rect.getHeight()));
g.draw(new Line2D.Double(rect.getX() + zm, rect.getY() + zm, rect.getX() + rect.getWidth(), rect.getY() + zm));
if (paintTriangle >= 0) {
final PolygonD p = new PolygonD();
p.addPoint(rect.getX() + rect.getWidth() / 2, rect.getY() + rect.getHeight() / 2);
int standoff2 = -1;
switch(paintTriangle) {
case Point.TOP:
{
p.addPoint(rect.getX() + standoff2, rect.getY() + standoff2);
p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + standoff2);
}
break;
case Point.LEFT:
{
p.addPoint(rect.getX() + standoff2, rect.getY() + standoff2);
p.addPoint(rect.getX() + standoff2, rect.getY() + rect.getHeight() - standoff2);
}
break;
case Point.RIGHT:
{
p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + standoff2);
p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + rect.getHeight() - standoff2);
}
break;
case Point.BOTTOM:
{
p.addPoint(rect.getX() + standoff2, rect.getY() + rect.getHeight() - standoff2);
p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + rect.getHeight() - standoff2);
}
break;
}
if (p.npoints > 1)
g.fillPolygon(p);
}
g.setStroke(tmp);
}
use of com.ramussoft.pb.DataPlugin in project ramus by Vitaliy-Yakovchuk.
the class AbstractDataPlugin method loadFromParalel.
public void loadFromParalel(final DataPlugin dataPlugin, final Function base, final File file, final GUIFramework framework) throws IOException {
Thread t = new Thread("Paralel-DataLoader") {
@Override
public void run() {
try {
framework.showAnimation(ResourceLoader.getString("Wait.Message"));
MemoryDatabase md = new MemoryDatabase() {
protected String getJournalDirectoryName(String tmp) {
return null;
}
@Override
protected File getFile() {
return file;
}
};
LoadFromParalelDialog dialog = new LoadFromParalelDialog(framework.getMainFrame(), md.getEngine("idef0"));
if (dialog.showModal()) {
((Journaled) getEngine()).startUserTransaction();
try {
framework.propertyChanged(ModelsView.SET_UPDATE_ALL_MODELS, false);
framework.propertyChanged(IDEF0TabView.DISABLE_SILENT_REFRESH, true);
DataPlugin fdp = NDataPluginFactory.getDataPlugin(null, md.getEngine("idef0"), md.getAccessRules("idef0"));
ModelParaleler paraleler = new ModelParaleler(fdp, dataPlugin, framework);
paraleler.loadFromParalel(base, dialog.isImportAll(), dialog.getSelected());
} finally {
framework.propertyChanged(IDEF0TabView.DISABLE_SILENT_REFRESH, false);
((Journaled) getEngine()).commitUserTransaction();
framework.propertyChanged(ModelsView.SET_UPDATE_ALL_MODELS, true);
framework.propertyChanged(ModelsView.REFRESH_ALL_MODELS);
}
}
FileIEngineImpl impl = (FileIEngineImpl) md.getEngine("idef0").getDeligate();
impl.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
framework.hideAnimation();
}
}
};
t.start();
}
use of com.ramussoft.pb.DataPlugin in project ramus by Vitaliy-Yakovchuk.
the class DataStore method paint.
@Override
public void paint(Graphics2D g) {
final Stroke tmp = g.getStroke();
try {
DataPlugin dp = ((NFunction) function).getDataPlugin();
Row row = dp.findRowByGlobalId(function.getLink());
final class PolygonD extends Polygon {
/**
*/
private static final long serialVersionUID = 1L;
public void addPoint(final double x, final double y) {
super.addPoint((int) x, (int) y);
}
}
;
g.setColor(function.getBackground());
final Rectangle2D rect = movingArea.getBounds(getBounds());
Rectangle2D r2d = null;
if (row != null) {
String string = row.getKod();
r2d = function.getFont().getStringBounds(string, g.getFontRenderContext());
left = movingArea.getIDoubleOrdinate(r2d.getWidth()) + 1;
} else {
left = EMPTY_LEFT;
}
g.fill(rect);
g.setFont(function.getFont());
paintText(g);
if (row != null) {
String string = row.getKod();
movingArea.paintText(g, string, new FRectangle(myBounds.getX() + 0.5, myBounds.getY(), left - 0.5, myBounds.getHeight()), Line.LEFT_ALIGN, 1, true);
}
g.draw(new Line2D.Double(rect.getX() + left, rect.getMaxY(), rect.getX() + left, rect.getY()));
paintBorder(g);
g.draw(new Line2D.Double(rect.getX(), rect.getY(), rect.getMaxX(), rect.getY()));
g.draw(new Line2D.Double(rect.getX(), rect.getMaxY(), rect.getX(), rect.getY()));
g.draw(new Line2D.Double(rect.getMaxX(), rect.getMaxY(), rect.getX(), rect.getMaxY()));
g.setStroke(new BasicStroke(2));
/*
* g.draw(new Line2D.Double(rect.getX() + rect.getWidth() - 1,
* rect.getY() + 1, rect.getX() + rect.getWidth() - 1, rect.getY() +
* rect.getHeight() - 1)); g.draw(new Line2D.Double(rect.getX() + 1,
* rect.getY() + rect.getHeight() - 1, rect.getX() + rect.getWidth()
* - 1, rect .getY() + rect.getHeight() - 1));
*/
final String string = getIDEF0Kod();
g.setFont(function.getFont());
double h = MovingArea.getWidth(0) + MovingArea.getWidth((int) function.getFont().getStringBounds(string, g.getFontRenderContext()).getHeight());
h = h * 0.7;
if (paintTriangle >= 0) {
final PolygonD p = new PolygonD();
p.addPoint(rect.getX() + rect.getWidth() / 2, rect.getY() + rect.getHeight() / 2);
int standoff2 = -1;
switch(paintTriangle) {
case Point.TOP:
{
p.addPoint(rect.getX() + standoff2, rect.getY() + standoff2);
p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + standoff2);
}
break;
case Point.LEFT:
{
p.addPoint(rect.getX() + standoff2, rect.getY() + standoff2);
p.addPoint(rect.getX() + standoff2, rect.getY() + rect.getHeight() - standoff2);
}
break;
case Point.RIGHT:
{
p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + standoff2);
p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + rect.getHeight() - standoff2);
}
break;
case Point.BOTTOM:
{
p.addPoint(rect.getX() + standoff2, rect.getY() + rect.getHeight() - standoff2);
p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + rect.getHeight() - standoff2);
}
break;
}
if (p.npoints > 1)
g.fillPolygon(p);
}
} catch (NullPointerException e) {
}
g.setStroke(tmp);
}
use of com.ramussoft.pb.DataPlugin in project ramus by Vitaliy-Yakovchuk.
the class HTTPParser method printArrowFunctionss.
private void printArrowFunctionss(final Row row) throws IOException {
final Vector funcs = new Vector<Row>();
List<Qualifier> list = dataPlugin.getEngine().getQualifiers();
for (Qualifier q : list) {
if (IDEF0Plugin.isFunction(q)) {
DataPlugin dp = NDataPluginFactory.getDataPlugin(q, dataPlugin.getEngine(), dataPlugin.getAccessRules());
funcs.addAll(dp.getRecChilds(dp.getBaseFunction(), true));
}
}
final Vector<UF> res = new Vector<UF>();
for (int i = 0; i < funcs.size(); i++) {
addFunction(row, (Function) funcs.get(i), res);
}
if (res.size() > 0) {
htmlStream.println("<p><table width=100% border=1>");
printMainTableTitle(RES.getString("UseInFunctions"), 3);
htmlStream.print("<tr>");
htmlStream.print("<td><b>");
htmlStream.print(RES.getString("kod"));
htmlStream.print("</b></td>");
htmlStream.print("<td width=100%><b>");
htmlStream.print(RES.getString("FunctionName"));
htmlStream.print("</b></td>");
htmlStream.print("<td><b>");
htmlStream.print(RES.getString("Type"));
htmlStream.print("</b></td>");
htmlStream.println("</tr>");
for (int i = 0; i < res.size(); i++) {
final UF uf = res.get(i);
htmlStream.println("<tr>");
htmlStream.print("<td>");
printStartATeg("rows/index.html?id=" + uf.function.getGlobalId().toString());
htmlStream.print(MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) uf.function));
htmlStream.print("</td>");
htmlStream.print("<td width=100%>");
printStartATeg("rows/index.html?id=" + uf.function.getGlobalId().toString());
htmlStream.print(uf.function.getName());
htmlStream.print("</td>");
htmlStream.print("<td>");
switch(uf.type) {
case MovingPanel.RIGHT:
htmlStream.print(RES.getString("RightElements"));
break;
case MovingPanel.LEFT:
htmlStream.print(RES.getString("LeftElements"));
break;
case MovingPanel.TOP:
htmlStream.print(RES.getString("TopElements"));
break;
case MovingPanel.BOTTOM:
htmlStream.print(RES.getString("BottomElements"));
break;
}
htmlStream.print("</td>");
htmlStream.println("</tr>");
}
htmlStream.println("</table></p>");
}
}
use of com.ramussoft.pb.DataPlugin in project ramus by Vitaliy-Yakovchuk.
the class FunctionOwnerAttributePlugin method getAttributeEditor.
@Override
public AttributeEditor getAttributeEditor(final Engine engine, final AccessRules rules, final Element element, Attribute attribute, AttributeEditor old) {
if (old != null)
old.close();
return new AbstractAttributeEditor() {
private SelectOwner component = new SelectOwner();
@Override
public Object setValue(Object value) {
DataPlugin plugin = NDataPluginFactory.getDataPlugin(engine.getQualifier(element.getQualifierId()), engine, rules);
component.setFunction((Function) plugin.findRowByGlobalId(element.getId()));
return value;
}
@Override
public Object getValue() {
Row row = component.getOwner();
if (row != null)
return row.getElement().getId();
return null;
}
@Override
public JComponent getComponent() {
return component;
}
};
}
Aggregations