use of com.ramussoft.pb.Row 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.Row in project ramus by Vitaliy-Yakovchuk.
the class RowClipboard method pasteFromClipboard.
public static void pasteFromClipboard(final Row parent) {
final String error = Main.dataPlugin.getRowPerrmision(parent);
if (error != null) {
JOptionPane.showMessageDialog(null, error, ResourceLoader.getString("no_permision"), JOptionPane.WARNING_MESSAGE);
return;
}
if (parent != null && parent.getRowType() != Row.TYPE_ROW)
return;
int i = 0;
final Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
final Transferable tr = clip.getContents(null);
byte[] bs;
try {
bs = (byte[]) tr.getTransferData(dataFlavor);
if (bs == null) {
if (parent == null)
return;
final String t = (String) tr.getTransferData(DataFlavor.stringFlavor);
if (t == null)
return;
boolean tag = false;
Row old = parent;
int oldLevel = 0;
Row r = null;
if (parent != null)
tag = true;
while (i < t.length()) {
int level = 0;
String name = "";
while (i < t.length()) {
if (t.charAt(i) != '\r')
break;
i++;
}
while (i < t.length()) {
if (t.charAt(i) == '\t')
level++;
else
break;
i++;
}
while (i < t.length()) {
if (t.charAt(i) == ' ')
break;
i++;
}
while (i < t.length()) {
if (t.charAt(i) != '\n')
name += t.charAt(i);
else
break;
i++;
}
if (!name.equals("")) {
if (level > oldLevel && r != null) {
old = r;
oldLevel = level;
} else
while (level < oldLevel) {
old = old.getParentRow();
oldLevel--;
}
r = Main.dataPlugin.createRow(old, tag);
r.setName(name);
}
i++;
}
} else {
}
} catch (final Exception e) {
}
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class RowClipboard method copyToClipboard.
public static void copyToClipboard(final Row[] rows) {
String copy = "";
for (final Row r : rows) {
for (int j = 0; j < getTagLevel(r); j++) copy += "\t";
copy += r.getKod() + " " + r.getName() + "\n";
}
copyToClipboard(rows, copy);
}
use of com.ramussoft.pb.Row 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.Row in project ramus by Vitaliy-Yakovchuk.
the class HTTPParser method getRecIDEF0Kod.
private static String getRecIDEF0Kod(final Row function) {
final Row f = function.getParentRow();
if (f == null || f.getParent() == null)
return "";
String id = Integer.toString(function.getId());
if (id.length() > 1)
id = "." + id + ".";
return getRecIDEF0Kod(f) + id;
}
Aggregations