I have prepared a mxGraphModel in my console app (that is written in Java) and I would like to automate one of the following:
opening draw.io / diagrams.net displaying its content
export it as an image to a file: png, svg, pdf, any type actually
The main goal is to visualise this graph anyhow.
Is there a way of doing this or something similar?
<mxGraphModel dx="1325" dy="753" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="q9gYvhBhvbTBP0PCmc48-1" value="" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="120" y="80" width="680" height="40" as="geometry" />
</mxCell>
<mxCell id="q9gYvhBhvbTBP0PCmc48-2" value="" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="120" y="160" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="q9gYvhBhvbTBP0PCmc48-3" value="" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="230" y="145" width="70" height="70" as="geometry" />
</mxCell>
<mxCell id="q9gYvhBhvbTBP0PCmc48-4" value="" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="450" y="170" width="20" height="20" as="geometry" />
</mxCell>
<mxCell id="q9gYvhBhvbTBP0PCmc48-5" value="" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="200" y="230" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="q9gYvhBhvbTBP0PCmc48-6" value="" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="310" y="215" width="70" height="70" as="geometry" />
</mxCell>
<mxCell id="q9gYvhBhvbTBP0PCmc48-7" value="" style="ellipse;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">
<mxGeometry x="530" y="240" width="20" height="20" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
You could publish a viewer version following https://desk.draw.io/support/solutions/articles/16000051941-how-to-publicly-publish-a-copy-of-your-draw-io-diagram
You could use the CLI in the desktop version to automate conversions, https://j2r2b.github.io/2019/08/06/drawio-cli.html
Related
I have a table on my db that has fields with jsonobject and jsonarray, I need to convert those values into jasperreport
<subDataset name="Dataset" uuid="06d196fb-4ae2-4735-9798-84a7072c4ea6">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="DataAdapter.xml"/>
<parameter name="data" class="java.lang.String"/>
<queryString>
<![CDATA[SELECT data1,data2,data3,data4,data5,data6
FROM ri_table WHERE id = $P{data}]]>
</queryString>
<field name="data1" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="data1"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ri_pj_fugados"/>
</field>
<field name="data2" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="data2"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ri_pj_fugados"/>
</field>
<field name="data3" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="data3"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ri_pj_fugados"/>
</field>
<field name="data4" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="data4"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ri_pj_fugados"/>
</field>
<field name="data5" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="data5"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ri_pj_fugados"/>
</field>
</subDataset>
<parameter name="data" class="java.lang.String"/>
<queryString>
<![CDATA[SELECT data1,data2,data3,data4,data5,data6
FROM ri_table WHERE id = $P{data}]]>
</queryString>
That way I extract the data from the database
<summary>
<band height="50">
<property name="com.jaspersoft.studio.layout"/>
<componentElement>
<reportElement x="0" y="0" width="572" height="50" forecolor="#595959" uuid="1326f896-5433-4071-b733-25f1c836a830">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.table.style.table_header" value="Table 1_TH"/>
<property name="com.jaspersoft.studio.table.style.column_header" value="Table 1_CH"/>
<property name="com.jaspersoft.studio.table.style.detail" value="Table 1_TD"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="Dataset" uuid="e3de465d-85b0-414f-9f7e-704f827b366a">
<datasetParameter name="data">
<datasetParameterExpression><![CDATA[$P{data}]]></datasetParameterExpression>
</datasetParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="70" uuid="300d2e97-ff2d-438b-8528-d565f835ccc8">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:columnHeader style="Table 1_CH" height="20" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="70" height="20" forecolor="#FFFFFF" uuid="5c21d9d0-510d-4852-904e-21a49992c04e"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[data1]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table 1_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement mode="Transparent" x="0" y="0" width="70" height="30" forecolor="#595959" backcolor="#FAF5F5" uuid="4b036592-a8fa-405c-ac85-12f7cda5dabd"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{data1}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="300d2e97-ff2d-438b-8528-d565f835ccc8">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:columnHeader style="Table 1_CH" height="20" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="90" height="20" forecolor="#FFFFFF" uuid="5c21d9d0-510d-4852-904e-21a49992c04e"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[data2]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table 1_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement mode="Transparent" x="0" y="0" width="90" height="30" forecolor="#595959" backcolor="#FAF5F5" uuid="4b036592-a8fa-405c-ac85-12f7cda5dabd"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{data2}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="70" uuid="300d2e97-ff2d-438b-8528-d565f835ccc8">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:columnHeader style="Table 1_CH" height="20" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="70" height="20" forecolor="#FFFFFF" uuid="5c21d9d0-510d-4852-904e-21a49992c04e"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[data3]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table 1_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement mode="Transparent" x="0" y="0" width="70" height="30" forecolor="#595959" backcolor="#FAF5F5" uuid="4b036592-a8fa-405c-ac85-12f7cda5dabd"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{data3}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="41" uuid="300d2e97-ff2d-438b-8528-d565f835ccc8">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:columnHeader style="Table 1_CH" height="20" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="41" height="20" forecolor="#FFFFFF" uuid="5c21d9d0-510d-4852-904e-21a49992c04e"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[data4]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table 1_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement mode="Transparent" x="0" y="0" width="41" height="30" forecolor="#595959" backcolor="#FAF5F5" uuid="4b036592-a8fa-405c-ac85-12f7cda5dabd"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{data4}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="61" uuid="300d2e97-ff2d-438b-8528-d565f835ccc8">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:columnHeader style="Table 1_CH" height="20" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="61" height="20" forecolor="#FFFFFF" uuid="5c21d9d0-510d-4852-904e-21a49992c04e"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[data5]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table 1_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement mode="Transparent" x="0" y="0" width="61" height="30" forecolor="#595959" backcolor="#FAF5F5" uuid="4b036592-a8fa-405c-ac85-12f7cda5dabd"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{data5}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</summary>
That way it creates a table with the generated fields, but in the json data it prints them in the json format
And I need for certain cases to print data2.dato or data2.otherdato
And I don't know how to do it, the same goes for the json array,
I need to iterate the jsons inside the array and print out certain data.
For those fields in your main query, that you know they are in JSON format you could create a JSON/JSONQL datasource that you pass to a subreport/table/list/etc.
The main steps would be:
Create a subDataset for that specific field or class of fields, e.g.:
<subDataset name="JsonFieldDataset" uuid="70d9d3c4-af50-48fc-a8a9-205697b62f0c">
<field name="dato" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="dato"/>
</field>
<field name="otherDato" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="otherDato"/>
</field>
</subDataset>
In the detail band have a component that constructs a JSON/JSONQL datasource. Posting only a simplified output with relevant parts:
<componentElement>
<reportElement />
<jr:table>
<datasetRun subDataset="JsonFieldDataset" uuid="318415a6-a046-4886-b04a-f13c3e9bf6f0">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JsonQLDataSource(new ByteArrayInputStream($F{data2}.getBytes("UTF-8")))]]></dataSourceExpression>
</datasetRun>
<jr:column />
<jr:column />
</jr:table>
</componentElement>
I have these labels here and they are not appearing...at all I ran the debugged and they are being populated with text, but they just not appearing, please help.
<mx:VBox
height="1920" width="1080"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:s="library://ns.adobe.com/flex/spark" xmlns:local="*" show="initModel()"
horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:Grid id="floorPlansListDetail" width="1080" height="1920" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:GridRow id="floorPlansDetailRow" width="1080" height="500" backgroundColor="#691a3a">
<mx:GridItem height="500">
<mx:Label id="Name" text="This is a test." fontSize="48" height="200" color="#FFFFFF" visible="true" />
<mx:Label id="Series" text="This is a test." fontSize="20" color="#FFFFFF" />
<mx:Label id="Price" text="This is a test." fontSize="30" color="#FFFFFF" />
<mx:Label id="ElevationA" text="This is a test." fontSize="20" color="#FFFFFF" />
<mx:Label id="ElevationB" text="This is a test." fontSize="20" color="#FFFFFF" />
<mx:Label id="Beds" text="This is a test." fontSize="20" color="#FFFFFF" />
<mx:Label id="Baths" text="This is a test." fontSize="20" color="#FFFFFF" />
</mx:GridItem>
</mx:GridRow>
</mx:Grid>
</mx:VBox>
its sooooo weird, if I put my label outside the grid it works and displays, but not inside the grid.
This code runs just fine for me:
<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script><![CDATA[
]]></fx:Script>
<mx:VBox
height="1920" width="1080"
xmlns:s="library://ns.adobe.com/flex/spark"
horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:Grid id="floorPlansListDetail" width="1080" height="1920" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:GridRow id="floorPlansDetailRow" width="1080" height="500" backgroundColor="#691a3a">
<mx:GridItem height="500">
<mx:Label id="Name" text="This is a test." fontSize="48" height="200" color="#FFFFFF" visible="true" />
<mx:Label id="Series" text="This is a test." fontSize="20" color="#FFFFFF" />
<mx:Label id="Price" text="This is a test." fontSize="30" color="#FFFFFF" />
<mx:Label id="ElevationA" text="This is a test." fontSize="20" color="#FFFFFF" />
<mx:Label id="ElevationB" text="This is a test." fontSize="20" color="#FFFFFF" />
<mx:Label id="Beds" text="This is a test." fontSize="20" color="#FFFFFF" />
<mx:Label id="Baths" text="This is a test." fontSize="20" color="#FFFFFF" />
</mx:GridItem>
</mx:GridRow>
</mx:Grid>
</mx:VBox>
</s:Application>
Is your mx import same as above?
I have a code in jrxml like.
<detail>
<band height="35">
<componentElement>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="38" y="12" width="457" height=<![CDATA[$P{col1_Header}]]> isRemoveLineWhenBlank="true" />
<hc:html xmlns:hc="http://jasperreports.sourceforge.net/htmlcomponent" xsi:schemaLocation="http://jasperreports.sourceforge.net/htmlcomponent http://jasperreports.sourceforge.net/xsd/htmlcomponent.xsd" scaleType="RetainShape" horizontalAlign="Left" verticalAlign="Middle">
<hc:htmlContentExpression><![CDATA[com.turborep.turbotracker.util.ReportUtils.toHtml($F{InlineNote})]]></hc:htmlContentExpression>
</hc:html>
</componentElement>
<rectangle>
<reportElement isPrintRepeatedValues="false" x="292" y="2" width="65" height="20" forecolor="#FFFFFF" />
</rectangle>
<rectangle>
<reportElement isPrintRepeatedValues="false" x="33" y="2" width="64" height="20" forecolor="#FFFFFF" />
</rectangle>
<rectangle>
<reportElement isPrintRepeatedValues="false" x="357" y="2" width="74" height="20" forecolor="#FFFFFF" />
</rectangle>
<rectangle>
<reportElement isPrintRepeatedValues="false" x="94" y="2" width="71" height="20" forecolor="#FFFFFF" />
</rectangle>
<textField isStretchWithOverflow="true">
<reportElement isPrintRepeatedValues="false" x="43" y="2" width="128" height="20" />
<textFieldExpression><![CDATA[$F{Product}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement isPrintRepeatedValues="false" x="173" y="2" width="100" height="20" isPrintWhenDetailOverflows="true" />
<textFieldExpression><![CDATA[$F{ItemQuantity}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement isPrintRepeatedValues="false" x="273" y="3" width="134" height="20" isPrintWhenDetailOverflows="true" />
<textFieldExpression><![CDATA[$F{Paragraph}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement isPrintRepeatedValues="false" x="407" y="3" width="103" height="20" isPrintInFirstWholeBand="true" />
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[($F{Price} == null) ? "" : "$"+$F{Price}.setScale(2, java.math.RoundingMode.HALF_UP)]]></textFieldExpression>
</textField>
<textField>
<reportElement x="16" y="0" width="23" height="20" />
<textElement>
<font isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<textFieldExpression><![CDATA[$V{REPORT_COUNT}+"."]]></textFieldExpression>
</textField>
</band>
</detail>
where my html content will grow bigger, so i want the html component to have auto height or it should support overflow. Now it is shrinking the size of the components as it grows.
Please help me with this. Thanks in advance.
http://jsfiddle.net/m7t9b/
<div style="width:625px;height:220px;overflow-y:hidden;overflow-x:scroll;z-index:10;">
<table width="1000" height="114" border="1">
<tr>
<td width="126"><blockquote>
<blockquote>
<blockquote>
<p> <img border="0" width="100" height="111" src="images/ahmed.png" alt="Mr. Ahmed" /> <br />
Mr. Ahmed <br />
Ext. 13417<br />
Room 417/323<br />
Ahmed#wcskids.net</p>
</blockquote>
</blockquote>
</blockquote></td>
<td width="126"><p><img width="100" height="111" src="images/teachers_clip_image002.jpg" alt="Mrs. Bageris " /><br />
Mrs. Bageris<br />
Ext. 13226<br />
Room 226<br />
EBageris#wcskids.net</p></td>
<td width="126"><p><img border="0" width="100" height="111" src="images/cetkovic.png" alt="Ms. Kudra" /><br />
Mr. Cetkovic<br />
Ext. 13305<br />
Room 305<br />
RCetkovic#wcskids.net</p></td>
<td width="126"><p><img border="0" width="100" height="111" src="images/teachers_clip_image002_0004.jpg" alt="Mrs. Kudra" /><br />
Mrs. Kudra<br />
Ext. 13225<br />
Room 225<br />
Dkudra#wcskids.net</p></td>
<td width="126"><p><img width="100" height="111" src="images/teachers_clip_image002_0006.jpg" alt="Mr. Sagman" /><br />
Mr. Sagman<br />
Ext. 13420<br />
Room 420<br />
SAGMANW#wcskids.net</p></td>
<td width="126"><p><img width="100" height="111" src="images/yasso.jpg" alt="Mr. Yasso" /><br />
Mr. Yasso<br />
Ext. 13418<br />
Room 418<br />
SAGMANW#wcskids.net</p></td>
</tr>
</table>
</div>
Instead of scrolling when I drag the scrollbar, the text below it gets highlighted. How do i fix this in IE 8?
Use the fiddle to see the whole code.
Use this code in your stylesheet,
-ms-overflow:auto;
May it will be help you...
Good Luck!
<s:TextArea id="txtAddress" x="118" y="31" width="150" height="88" maxChars="100"
tabIndex="2"/>
txtAddress.text="AAAAAAAAAAAA CCCCCCCCCCCCCCCCCCCCCC P OABCDEFGHIJKLMNOPQRSTUVWXYZWSDER-682021";
This actionscript code crashes flash plugin. Some times it will not crash but the text inside the text area will be overwrite twice. The same is happening with every browser I have tested. I think this is flash's bug.
(Please note that if width of the textarea or if the value changes, it will work fine)
Can any one comment on this?
Below is the markup code:
<s:BorderContainer x="2" y="32" height="125" width="565" borderColor="#488AC7"
backgroundColor="#EEF0EE" cornerRadius="2">
<s:TextInput id="txtPhoneNo" x="407" y="3" width="150" maxChars="15" tabIndex="3"/>
<s:Label x="12" y="13" text="Name" fontWeight="normal" />
<s:TextInput x="118" y="3" width="150" id="txtName" maxChars="100" tabIndex="1" />
<s:Label x="12" y="40" text="Address" fontWeight="normal"/>
<s:TextArea id="txtAddress" x="118" y="31" width="150" height="88" maxChars="100"
tabIndex="2"/>
<s:Label x="302" y="13" text="Phone No." fontWeight="normal"/>
<s:Label x="302" y="40" text="Mobile" fontWeight="normal" />
<s:TextInput id="txtMobile" x="407" y="31" width="150" maxChars="15" tabIndex="4"/>
<s:Label x="302" y="70" text="Email" fontWeight="normal" />
<s:TextInput id="txtEmail" x="407" y="60" width="150" maxChars="100" tabIndex="5"/>
<s:Label x="302" y="101" text="ECS Account NO"/>
<s:TextInput id="txtECSAcNo" x="407" y="91" width="150" tabIndex="6"/>
</s:BorderContainer>
This is isolated to your system or implementation.
What you have provided is functional:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected function creationCompleteHandler(event:FlexEvent):void
{
txtAddress.text = "AAAAAAAAAAAA CCCCCCCCCCCCCCCCCCCCCC P OABCDEFGHIJKLMNOPQRSTUVWXYZWSDER-682021";
}
]]>
</fx:Script>
<s:TextArea id="txtAddress"
x="118"
y="31"
width="150"
height="88"
maxChars="100"
tabIndex="2" />
</s:Application>
it seems somewhere else, you set the fontsize of the textarea to an invalid value. I had the same problem before, maybe somewhere you just set it to some value like "10px".