Is it possible to have a key to the class diagram's field/method visibility labels in the legend, using the real icons?
i.e. getting the real icons in the table following diagram
#startuml
class Dummy {
-field1
#field2
~method1()
+method2()
}
legend
|= field |= method |= |
| - | - | private |
| # | # | protected |
| ~ | ~ | package private |
| + | + | public |
endlegend
#enduml
Things I've tried without success:
Looking for suitable openiconic icons (there don't seem to be any)
Linking to an image based on the file names on http://plantuml.com/class-diagram (don't exist)
This is pretty good (certainly good enough for my purposes):
#startuml
class Dummy {
-field1
#field2
~method1()
+method2()
}
skinparam legendBackgroundColor #ffffff
legend
|= field |= method |= |
| <img:http://s.plantuml.com/private-field.png> | <img:http://s.plantuml.com/private-method.png> | private |
| <img:http://s.plantuml.com/protected-field.png> | <img:http://s.plantuml.com/protected-method.png> | protected |
| <img:http://s.plantuml.com/package-private-field.png> | <img:http://s.plantuml.com/package-private-method.png> | package private |
| <img:http://s.plantuml.com/public-field.png> | <img:http://s.plantuml.com/public-method.png> | public |
endlegend
#enduml
Related
I have a Windows Form C#/.Net project. There is a form with several user controls on it. Each user control is docked so that it takes up the whole form. When a button on one user control is clicked, that user control is hidden and another one appears. This was done by a coworker and is in production and can't be changed (that is, I absolutely can't get rid of the user controls and can't change them unless really necessary). I want a panel (or maybe another user control) on the form that can be brought up on some event (like hitting a certain key combination like CTRL-Q). However, if I put a KeyDown event on the form, it never gets triggered because one of the user controls always has the focus. I could put my new panel on each user control and have KeyDown events on each of them, but I'm not really supposed to change the existing user controls and I don't really want multiple instances of this panel and multiple events. How can I trigger a form level event when one of the user controls has the focus?
Here is how the form, user control, and panels are laid out. The user controls are actually docked to fill the entire form; I staggered them in this illustration so you could see them all.
----------------------------------------------------------------------
| form1 |
| |
| --------------------------------------------------------------- |
| | userControl1 | |
| | | |
| | | |
| | -------------------------------------------------------- | |
| | | userControl2 | | |
| | | | | |
| | | | | |
| | | -------------------------------------------------- | | |
| | | | userControl3 | | | |
| | | | | | | |
| | | --------------------------------------------------- | | |
| | | | | |
| | -------------------------------------------------------- | |
| | | |
| --------------------------------------------------------------- |
| |
| |
| ------------------------------------------------------------------ |
| | panel or user control on top of everything, visible on demand | |
| ------------------------------------------------------------------ |
| |
----------------------------------------------------------------------
What I want is for this event from form1 to get triggered no matter what user control is active:
private void form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.Q)
{
panel1.Visible = true;
}
}
If you want to use the KeyDown or KeyUp events on a form, always make sure that the property KeyPreview on the form is set to TRUE
This property will then make sure the form gets the keystroke first, before the controls do
See also this
EDIT
Another way is to stop using the KeyDown/KeyUp event for this, and override the ProcessCmdKey on the form, as #Jimi suggested in his comment
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
bool Result = true;
if (keyData == Keys.Control | Keys.Q)
{
panel1.Visible = true;
}
else
{
Result = base.ProcessCmdKey(ref msg, keyData);
}
return Result;
}
In Cucumber, we can directly validate the database table content in tabular format by mentioning the values in below format:
| Type | Code | Amount |
| A | HIGH | 27.72 |
| B | LOW | 9.28 |
| C | LOW | 4.43 |
Do we have something similar in Robot Framework. I need to run a query on the DB and the output looks like the above given table.
No, there is nothing built in to do exactly what you say. However, it's fairly straight-forward to write a keyword that takes a table of data and compares it to another table of data.
For example, you could write a keyword that takes the result of the query and then rows of information (though, the rows must all have exactly the same number of columns):
| | ${ResultOfQuery}= | <do the database query>
| | Database should contain | ${ResultOfQuery}
| | ... | #Type | Code | Amount
| | ... | A | HIGH | 27.72
| | ... | B | LOW | 9.28
| | ... | C | LOW | 4.43
Then it's just a matter of iterating over all of the arguments three at a time, and checking if the data has that value. It would look something like this:
**** Keywords ***
| Database should contain
| | [Arguments] | ${actual} | #{expected}
| | :FOR | ${type} | ${code} | ${amount} | IN | #{expected}
| | | <verify that the values are in ${actual}>
Even easier might be to write a python-based keyword, which makes it a bit easier to iterate over datasets.
How do I resize the entire ultragrid control in code to only show its contents?
i.e: I have
-----------------------------
| | | | blank |
| | | | |
| | | | |
| ------------ |
| |
| |
|____________________________|
and I want the borders to be tight to the grid
My best bet so far was to query DefaultLayout.Bands(0).GetExtent() and use that as the width of the grid.
I'm designing a card game (think Magic the Gathering for purposes of this example) and want to take the information for the cards and store it in a database. In this game, there are events (for instance, one card might say "when this comes into play, opponent takes 2 damage") that are tied to a particular card. The design decisions have led to loosely building the cards in a builder factory, but I'm looking to take the cards and store them in a database instead. Since most of the cards are instances of a base "Card" class, it's easy to load the features common to every card (name, cost, etc.) but I've struggled to find a good way to tie these events to a single type of card. The only way I have thought of so far was to store the function name in the database and use late binding to register the event when the card is loaded. Is there a better way to do this?
The only similar post I've found is this: Store function name in database and then execute it
The answer of using eval() seems similar to late binding, but got down-voted. However, no one had a better suggestion how to perform this function.
This sounds like a usable approach, however it is questionable if it is a good one.
Why don't you construct propper objects from a card representation in the database? Either by using an object database, or, more likely, but using object-relation-mapping. THis way you can represent each type of card in a clean and easy to read and use way yet work with rich instances of specialized classes derived from a common base class.
So you use a common table to store all the cards like this:
+-------------------------------------------------+
| card type | data1 | data2 | data3 | ... | dataN |
+-------------------------------------------------+
| Card | 123 | 456 | 789 | ... | abc |
| CardS1 | 123 | 456 | 789 | ... | abc |
| CardS3 | 123 | 456 | 789 | ... | abc |
| CardS2 | 123 | 456 | 789 | ... | abc |
...
And a class hierarchy like this:
+---------------------------+
| class Card |>-+
+---------------------------+ |
| var data1 | |
| var data2 | |
| var data3 | |
| ... | |
| var dataN | |
| baseMethod1() | |
| baseMethod2() | |
+---------------------------+ |
|
+---------------------------+ |
| class CardS1. public Card |<-+
+---------------------------+ |
| specialMethod_1_1() | |
+---------------------------+ |
|
+---------------------------+ |
| class CardS2. public Card |<-+
+---------------------------+ |
| specialMethod_2_1() | |
| specialMethod_2_2() | |
+---------------------------+ |
|
+---------------------------+ |
| class CardS3. public Card |<-+
+---------------------------+
| specialMethod_3_1() |
+---------------------------+
I am trying to design a django app that will help me to manage my litte shop. I would like to be able to make bills in an easier way than now but I need some help with the database design.
Right now I have it this way:
class Product(models.Model):
name = models.CharField(max_length=200)
price = models.IntegerField()
class Article(models.Model):
product = models.ForeignKey(Producto)
qty = models.IntegerField()
id = models.AutoField(primary_key=True)
class Order(models.Model):
number = models.CharField(max_length=20, primary_key=True)
client = models.ForeignKey(Client)
invent = models.ForeignKey(Invent)
articles = models.ManyToManyField(Article)
I doubt that Product-Article design is well done, there should be a different way to do this because I will have many repeated data in my DB.
Another question is if the article is "owned" by the order or if the article has an order to "belong", I don' know if the question is clear.
EDIT1:
My thought about Product-Article:
+------------------+ +----------------+ +------------------+
| Product | | Product | | Article |
|------------------| |----------------| |------------------|
| | | | | |
| Name | | Name <--------+ Product |
| | VS | | | |
| Price | | | | |
| | | Price | | Qty |
| Qty | | | | |
+------------------+ +----------------+ +------------------+
And the other question is:
+------------------+ +-----------------+ +--------------+
| Order | | Order <-------+ Article |
|------------------| |-----------------| |--------------|
| Number | +--------------+ | | | |
| +------------->| Article | | Number | | ... |
| Client | +----------> +--------------+ VS | | | |
| | | | | Client | + Order |
| ... | | | | | | |
| | | | | ... | +--------------+
| Articles + + | | |
+------------------+ +-----------------+
Maybe something like this:
class Product(models.Model):
name = models.CharField(max_length=200)
current_price = models.IntegerField()
class Order(models.Model):
number = models.CharField(max_length=20, primary_key=True)
client = models.ForeignKey(Client)
invent = models.ForeignKey(Invent)
total = models.IntegerField()
class Article(models.Model):
product = models.ForeignKey(Product)
order = models.ForeignKey(Order)
qty = models.IntegerField()
price = models.IntegerField()
Check also this: Extra fields on many-to-many relationships