In Enterpise Architect cannot add interruption flow - uml

I'm fairly new to Enterprise Architect, thus the question might be very simple. I'm modelling an activity diagram. The flow is pretty straightforward. However, I cannot add an interrupt flow between two actions.
Here's the behavior of the system: a user presses a button, while he's holding the button, the machine is moving towards the target. As soon as the machine reached the target, the application proceeds to the next step. If the user releases the button, the machine stops and waits till he presses it again to re-start the movement.
Here's the description of my model: I have the action "Press button", the control flow goes inside of the InterruptibleActivityRegion. Inside of the region I iteratively check if the target is reached. I also have action "Release button". I want to add interruption flow from it to the very beginning (to go before button press action). However, I can't. when I right-click on the Release button action, only control flow or object flow can be created. I've tried clicking on interruption flow in the Toolbox, but whenever I click on the Release button action, it's not added. I've also tried to use Receive instead of Action for Release button - only control flow can be added to it. Do you have any idea why interruption flow cannot be added?

The connector might not be available in the quick-link menu (which is displayed when you drag a connector from one element to another in a diagram), but it should still be in the activity diagram toolbox, next to control and object flow.

Figured out the solution. The reason why I couldn't connect the action which is a cause of the interruption to a different action with a interruption flow is that the first action didn't belong to the interruption region. When I created the action, I placed it inside of the region, but didn't check in the object browser which element became its parent. After moving the action to be a child of the region, I'm able to connect it with an interruption flow to other actions.

Related

Is the launch of an on-page modal considered a "change of context" when considering WCAG?

I have an accessibility requirement that states:
"Verify that, upon input within the stated UI component, the user input does not force a change of context unless the user has been previously advised through messaging.
-- Change of context = That no change occurs in the user agent, viewport, focus of that particular element, or content changes that impact meaning."
WCAG give an example of a failure to be a "pop-up window". To non-developers, I am thinking that a on-screen modal could be perceived as a pop-up window. Does anyone else agree?
We literally have dozens of modals all over the site I am working on and need to make sure before I start throwing aria-labels all over the place.
Yes, it is a change of context. In operating systems, this is communicated to users through the user of the ellipsis (...) at the end of the name e.g. a button with the text "Save..." can be expected to popup a dialog, whereas a button with the text "Save" will be expected to just save.
You can use aria-haspopup="true" on a button, in combination with a convention like the ellipsis to convey this in an accessible manner. http://www.w3.org/TR/wai-aria/states_and_properties#aria-haspopup

How to sequence a custom action script after a specific dialog?

I have created a basic MSI project using InstallShield, I want to run a custom action script between two dialogs.
This shows my execute sequence, I want to move the custom action MyCustomActionScript to between the two dialogs indicated by the arrow.
How can I do this? Do I need to change things around somehow so that the dialogs are not nested (this is the way they are created naturally)? Or do I have to do something else, like run a DoAction on the target dialog? If so, will the execute sequence automatically move to the next dialog upon completion of the script, or do I have to script something to move the execution?
(Note that the script is a simple manipulation of the INSTALLDIR property, nothing complicated.)
Only the first dialog of the wizard loop is in the UI sequence. The rest are invoked by NewDialog control events. You want to look into the DoAction control event to invoke your custom action.
Custom actions scheduled in this fashion should only perform data acquisition / validation. Changes to the machine state should only occur in the execute sequence.
To run an action between LicenseAgreement and InstallSettings, you must indeed set up a control event DoAction. In this case you would add the DoAction on the behavior of LicenseAgreement's Next button so that it is invoked in the same scenarios that the Next button's NewDialog takes you to InstallSettings.

Is it possible to Derive class from CWinThread Class in dialog based application

I am working with Dialog based application.
My Question is that, I want to show Waiting dialog, until some database operation carried out.
i Used Derived class from CWinThread, but problem is that, when this thread close, the background (Main application dialog) remains at deactivated means( it hide behind another window).
i am thinking that, this is happening because of WaitDialog used CWinThread class.
The problem is not unique to a dialog based application. Creating windows of any kind in more than one thread is difficult and not recommended. In your case it sounds like your wait dialog is modal, while its parent dialog is in another thread. That is even worse and can lead to deadlocks between threads.
The reliable solution is to put the wait dialog (and all other GUI) in the main thread, and the lengthy database processing in a secondary thread.
Another alternative would be to use a Modeless Dialogbox which can also optionally show the status and call the DestroyWindow function when the database operation is completed -- you may need to disable some operations of the main window while the Modeless Dialogbox is visible, though.
From the comments on my previous answer, it looks like that alternative is not viable in this situation.
Maybe a better way would be to create a normal modal "wait" dialog box, start the background thread in the dialog's InitDialog, periodically check the status of the thread using a timer and end the dialog when the thread completes?

How to handle LWUIT dialogs shown on background threads

I have written an application in LWUIT targeted for a J2ME phone (Sprint DuraXT). The application is for pickup and delivery van drivers. It receives dispatches from a back-end dispatching system that describe pickups and delivers the driver must make. As the drivers, execute the pickups and deliveries, the driver enters status information that is sent back to the dispatching system.
Now, during the processing of a pickup or delivery, the driver may be presented with error dialogs (incorrect field entry), yes/no confirmation dialogs (confirming some action) and information dialogs (indicating some status the driver should be aware of).
In addition, there is a background thread listening for dispatches coming from the back-end server. In the current implementation, this background thread can also create yes/no confirmation dialogs and information dialogs. These dialogs are more like an alert as they have an associated sound, but they are simply dialogs.
As long as these two dialogs do not occur “simultaneously” every thing works as expected. You can dismiss the dialogs and the app proceeds as expected.
However, when you are on a screen and there is a dialog already showing and a second one from the background thread occurs, you sometime wind up with the wrong screen showing and it is “frozen”. E.g. the soft keys have no effect.
My hypothesis is that there is a race condition between the threads that are dismissing the dialogs. It goes like this. The EDT is blocked showing the dialog that arises as part of the form’s logic. The background thread is also blocked showing a dialog. Now when the dialog showing on the EDT is dismissed, the form is restored, but the EDT may go off and display another form (via show()). When the dialog displayed by the background thread is dismissed, the form which was showing when the dialog was initially displayed is sometimes restored. Now, the display shows a different form than the one the EDT might have shown.
It is pretty clear that this problem is caused by the dialogs resulting from the activities of the background thread. So the basic question is: “How to handle the dialogs arising from the background thread?” I have some thoughts but none yield a particularly clean implementation. I am hoping somebody has had to deal with this same problem and has a suggestion.
I have tried synchronizing the dialog construction and display so that only one dialog can get displayed at a time. This certainly improves the UI, but does not fully resolve the problem. The race begins when the first dialog is dismissed. Here are some other ideas,
If a dialog is shown by a thread other than the EDT, call show on the form at the top of the display stack when the dialog is dismissed. This is a bit of a hack, but may be a workaround.
Run dialogs to be shown by the background thread on the EDT. There are several ways to do this, but the question is will it resolve the problem? Will using an EventDispatcher help? I have experimented using an EventDispatcher to fire an ActionEvent containing a subclass of a Dialog as a source. The subclass contains a show() method which invokes the correct form of the Dialog show method. The class holding the EventDispatcher (global to the application) listens for these events. When the event arrives, the show method is invoked. For information dialogs that simply continue execution from wherever they are dismissed, this should work. For yes/no dialogs, you may have to create something like yes/no callbacks to handle the bifurcation in the logic. And what is not obvious is if this will actually serialize the processing of the dialogs on the EDT thread. This seems complicated.
Any ideas?
I actually hit upon the solution after a bit of experimentation. Because the Dialogs are part of a more compilcated action involving yes/no Dialogs and database queries, I found I had to wrap the whole action in a class which implements the Runnable interface. Then I run the action via Display.getInstance().callSeriallyAndWait(runnable).
So others may benefit from this discussion, here is a example of one of these classes with the action embedded in the run method.
private class CancelOrder implements Runnable {
private KWMap order;
public CancelOrder(KWMap order) {
this.order = order;
}
public void run() {
String orderNum = getString(order, OrderTable.ORDER_NUM);
if (legStatusTable.isOrderStarted(orderNum)
&& !orderTable.isOrderComplete(order)) {
String msg = "You received a cancellation message for Order "
+ orderNum
+ " which has been started but is not finished."
+ "\nDo you want to keep it?";
if (app.yesNoDialog(msg, "Yes", "no")) {
sendCancelResponse(order, "Yes", "");
} else {
deleteOrder(orderNum);
sendCancelResponse(order, "No", "");
}
} else {
// order has neither been started nor completed.
deleteOrder(orderNum);
sendCancelResponse(order, "Yes", "");
app.alertDialog("Dispatcher cancelled Order " + orderNum);
}
}
}
The key thing here is that the action contains logic depending on how a user responds to a yes/no Dialog and there are operations on an underlying database and messaging subsystem as well. Except for the Dialogs, nothing in this action blocks the EDT for more than a few 100s of milliseconds, so the application runs very smoothly. The app coorectly handles dislogs stacking on top of each other which was a problem with the simple apporach of letting these actions run on the background (non EDT) thread.

How to avoid use of timer when using TThread to communicate with UI thread

I have a TThread which receives and sends to a device on a COM port. After I read the data, I want to activate the GUI (not in the same thread) using Synchronize(function name). However, when I call the GUI's form function to perform a button click, I get an access violation. I checked to see if the form's value is null and it is not, since this would be an obvious reason for access violation. Right now, I am setting global flags and using a timer that continuously checks to see if a certain condition is met and if so, then I fire off the button click event in that form. That seems to be the only way to avoid getting the access violation.
I really don't like timers so is there a way to avoid having to use a timer on the form?
You can post a message to the window in question. The timer works in a similar manner. It just fires off a windows message inside the form. You obviously have a handle to the window.
CWnd::PostMessage(...) Don't use send message, it gets processed inline and could cause your thread to stop working.
Typically when you have a worker thread that attempts to access Guithread, they conflict. It's been a while since I've used MFC and threading but that's what I remember. I believe it's documented to work that way.
I found the problem. I thought I was checking if my Form was null, but I was not. I fixed it making sure the form I was referencing is not null.
Edit: Turns out that one of the forms that is called when I call Fbutton1Click() is Modal so it blocks my thread. I ended having to go back to a timer to call the button click instead.. oh well.

Resources