I am drawing UML with draw.io. And I want to insert a code block aside a class UML. When I write code(java/c) in a 'Text' block, it seems not tidy. Is it possible to insert a tidy code block (like markdown code block) in a UML page of draw.io?
There is no native support for "tidy" code blocks in draw.io.
A workaround would be to create a picture of your code-block using a tool like carbon and import it into your UML diagram as an image.
Related
I was writing my own text editor in Electron using React and I tried to do some basic syntax highlighting. The user writes their code inside a textarea, but there is no way to insert markup inside a textarea so I can't color text that way.
I found this jquery plugin which adds a backdrop behind the textarea so we can put a background color in certain places however I wanted the text themselves to be colored (which can't be done as the textarea is in front of the backdrop).
Any ideas about how other IDEs like Visual Studio Code (also written in electron) pulled this off?
There are multiple approaches that can work here.
One way could be using a div with a contenteditable="true" attribute instead of a textarea. This way you can both write text inside the element and style its contents. Of course this creates its own issues that would have to be dealt with - when to parse the code, how to reposition the caret and more. Depending on the approach, MutationObserver could come in handy.
Another way would be to not use any built-in writing functionalities at all and implement your own. Listen to keyboard events and programatically insert characters. In that case you would also need to implement your own caret, selection etc., which is not easy.
VS Code is open source, so you can actually take a look under the hood and see how the editor is made. They use a completely bespoke editor called Monaco but its source code is in the VS Code repo. This file is a good start.
I'm using Microsoft Visio to draw my UML Diagrams.
More specifically the "UML Class" package as shown below
I want to define my class as Abstract and I don't find any "Properties tab" or somth to manage any class options.
Is there any way to achieve this another way than simply set the class name as Italic in the text format option ?
EDIT
The solution provided here doesn't seem to fit with newer version of Visio as long as i can't find a "Properties" tab.
MS Visio is not the greatest tool to create UML models. Of course it lets you draw nice diagrams, especially with the right packages, but what you get is not really related to each other.
Getting back to your question, there are many different possibilities depending on specific UML package you use. If you don't have anything special and you can't find some "Abstract" or IsAbstract" property of the class, you can always just change the text format to Italic.
All the "smarts" (for want of a better name) have been removed from the UML shapes in the later versions of Visio, 2013 onwards as far as I know. There is a "Properties" attribute to the Class shape in Visio 2010 but not in Visio 2016. The shapes are now just plain and simple.
I tried to use UMLDesigner to draw my project related diagrams. I see there is a Arrange functionality that can automatically layout diagram elements and links to save some manual work. But when i used it in my Activity diagrams it designed it upside down.
Here is an example. I created following simple activity diagram.
And here is how auto layout result for the same model looks like: auto layout.
The initial node is at the bottom and the final nodes are on top. But i want it the other way - to start at the top and end at the bottom. Is there a way to configure this?
I tried pinning starting and final nodes but it just made a mess after arranging the rest automatically. I searched the settings but couldn't find anything. I use UML Designer Version 7.1.0.
Thanks ahead for any help.
I am sorry there is no way from the preferences to change this behaviour.
This is because I never provide a specific layout for this diagram. Please, fill an issue in the bug tracker and it will be fixed for the next version of UML Designer as it is really easy to fix: https://github.com/ObeoNetwork/UML-Designer/issues.
Thanks for your feedback!
I am using UMLET to design the UML Sequence diagram for my system, i don't use the "all in one" option but the simple one dragging and editing the diagram components, so far so good, but i need to create an alt fragment with 2 or 3 guard conditions, i can't findd examples or documentation about it, the fragment component in the program doesn't show how to achieve my goal, could someone please help me?
You can create alt fragment with the interaction frame thingy in the palette.
Then in the diagram itself you can populate it with something like
alt
--
[x>0]
--
[x=0]
--
[x<0]
Note:
I would highly advise you against using this palette. Once you start making changes to it, it is a nightmare to manage as everything starts to misbehave — e.g. if you wanted to increase the space for [x=0] part, then you would add <enter> in the Properites window, however the messages and rest of the diagram will not move and you have to adjust it manually.
Not to mention that creating it manually this way is more time consuming.
So if you want to create sequence diagrams, you should either use the all-in-one palette, or other tool, such as PlantUML which has much nicer syntax (and looks better): http://plantuml.com/sequence.html
I am using the latest starUML BETA and I'm having these problems.
I have created 2 sequence diagrams and save it as a .mdj file.
After a few days, I wanted to continue working on the diagrams. But when I opened the file, the diagrams I was working on was not displayed. There is also nothing under the Working Diagrams area. But the Explorer section showed the items I have used in creating my diagrams.
I don't want to make my diagrams from scratch again. Is there a way that the diagrams will be displayed again?
I had exactly the same problem. Solved by DOUBLE clicking on Activity Diagram.
To open the diagram, you should first click on the sequence diagram on the Explorer area on the right of the screen and then you'll see that your .mdj file is loaded.
As a reference: http://docs.staruml.io/en/latest/editing-elements-and-diagrams.html#open-diagram