Set class on clicked connection - jsplumb

Is it possible to highlight at selected connection by setting a css class that works in most browsers.
I have tried to add a class that uses filter to create a "dropshadow" but that only works in chrome.

When ever a connection is clicked (selected) then you can modify its properties as I have changed the color of connection through setPaintStyle function. For more such functions refer the API Document
jsPlumb.bind('click', function (connection, e) {
connection.setPaintStyle({fillStyle:'red'});
});

Related

How to refresh a BeanFieldGroup after a client request whitout a button?

i hope i will find help here.
Is it possible to refresh a single component in Vaadin.
For example do a client request which change a value [ type = String] inside a single component and refresh this component after it immediate.
Here the content for better understanding:
My Vars:
private static BeanFieldGroup<Service> binder = new BeanFieldGroup<Service>(Service.class);
private FormLayout form = new FormLayout();
My Constructor:
public ServiceDetails()
{
vl = new CssLayout();
vl.addComponent(new Label("Service Details"));
vl.addComponent(form);
vl.setStyleName("details");
vl.setSizeFull();
addPropertyChangeListener(new MyPropertyChangeListener());
refreshBT = new Button("Show Updated Content");
form.addComponent(refreshBT);
addListener();
form.addComponent(binder.buildAndBind("S-ID: ", "id"));
form.addComponent(binder.buildAndBind("Name: ", "name"));
form.addComponent(binder.buildAndBind("Description: ", "description"));
form.addComponent(binder.buildAndBind("Service Tags: ","allTagsOfService"));
form.addComponent(binder.buildAndBind("Attributes: ","allInOnAtt"));
form.addComponent(binder.buildAndBind("Capabilities: ","allInOnCapa"));
form.addComponent(binder.buildAndBind("Categorization: ","allInOnCat"));
form.addComponent(binder.buildAndBind("Relations: ","allInOnRela"));
form.addComponent(binder.buildAndBind("Stakeholder: ","allInOnStkh"));
form.addComponent(binder.buildAndBind("Resources: ","allInOnRes"));
form.addComponent(binder.buildAndBind("Quality: ","quality"));
form.addComponent(binder.buildAndBind("Process: ","process"));
form.addComponent(binder.buildAndBind("Finance: ","finance"));
form.setImmediate(true);
setCompositionRoot(vl);
}
The Button will update the shown content for the user. If a AJAX-request is done the data will be at the server but not shown. If the button is clicked the userview will be updated correctly.
Each variable change call a method which setup my content for the BeanFieldGroup.
public void setService(Service service)
{
setServ(service);
binder.setItemDataSource(getServ());
}
The Problem is now that i need to click this button for a userview refresh, if i clicked on the service inside a canvas structure. By the way this structure is realized in javascript, and a click will always do a AJAX-request [ type = POST] to the server. The send data will be saved correctly in a temporary variable but nothing will be shown at my page. The content change will not be shown to the user page. But this only appear if i use AJAX-requests. If i do click at another component it works without using the button. ):
Any idea how to fix this kind of problem.
Thx for each reply.
When working with http, you have to keep in mind, that the server usually can't inform the client about changes done on server side.
In vaadin, if you modify the UI on server side, outside of the normal "Action from client", then these changes will show up only on the next interaction with the client.
If you need to send the changes from the server to the client, you will have to use a push technology, where the server can inform the client about new/changed content.
Fortunally vaadin includes a easy to use implementation of this push system.
In the Book of Vaadin there is a complete section about server push.
Basically you add the #Push annotation to your UI class and add the required libraries.
You have to keep in mind, that you will need to synchronize access to the UI to get consistent results. (Also documented in the book of vaadin)

Update Panel in Firefox loading forever

I have 2 select controls. One change event updates the other. Also, it updates a grid inside update panel.
On page load, I call an ajax method to get the drop down values for both select. I populate the control and trigger a button click event which then updates the grid inside the update panel.
Everything works fine in all browsers, except in Firefox. Any idea as to why this might be happening?
Upon using break point i discovered that in other browsers the server side method is called first and then the ajax method while in Firefox its the other way around.
I narrowed down the issue to when using EndRequestHandler. I use EndRequestHandler event to change the class for a control. I remove that functionality and its perfect. The code for it is below:
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function EndRequestHandler()
{
var type = $('[id$=ddlType]').val();
$('a[data-categoryid="' + type + '"').parent().addClass('selected');
}
Finally, there was a typo in my code. I forgot the closing square bracket in the EndRequestHandler. Surprisingly, the other browsers didn't care about it!
Updated code.
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function EndRequestHandler()
{
var type = $('[id$=ddlType]').val();
$('a[data-categoryid="' + type + '"]').parent().addClass('selected');
}

wicket AjaxLink onclick not responding

I'm building a website with wicket. I have a modal window that opens from an ajaxlink from the main page. The problem is that when I added a CSS to my HTML code in order to make it more visible attractive, it stopped working. So now, when I click in the AjaxLink that opens the modal window, nothing happens and I can't figure out why. Any Ideas??
This is the code of the AjaxLink:
AjaxLink privacyLink = new AjaxLink<Void>("privacylink") {
#Override
public void onClick(AjaxRequestTarget target) {
// TODO Auto-generated method stub
modal2.show(target);
}
};
One more comment. This AjaxLink is introduced as a part of a ListView, so actually there are multiple AjaxLinks.
In order for the AjaxLink to refresh you will need to call something along the lines of:
modal2.setVisible(true);
target.addComponent(modal2Container);
Where modal2 is the component that you want to control the visibility of, and modal2Container is a WebMarkupContainer with .setOutputMarkupId(true) that modal2 is added to when the page/panel is constructed.
I have found the examples at http://www.wicket-library.com/wicket-examples-1.4.x/ajax/ to be particularly useful (I'm using 1.4, but there are other examples for whichever version of wicket you are running you can get to from http://wicketstuff.org/).
I finally found the solution!!, It was a problem of the version of jQuery that I was using (1.4.2) so I just changed it to 1.5.2 and it worked!

how Remove A Control From Ajax Mode Inside A Repeater?

I am using radajaxmanager for getting ajax mode.
But many times I prefer to remove a control such as a link button inside a repeater from ajax mode (means repeater has been added to radajaxmanager).
How can I do this job with radajaxmanager?
That control goes in the right way and it is not appeared in the radajaxmanager configuration, and we only have repeater there.
we should use OnRequestStart event (client-side) of RadAjaxManager like below :
function OnRequestStart(s, e) {
if (e.get_eventTarget() == 'bla') {
e.set_enableAjax(false);
}
}
A more comprehensive set of examples on how to specifically exclude a control can be found in the Telerik documentation here:
http://www.telerik.com/help/aspnet-ajax/ajax-exclude.html

Eclipse RCP: How can I update a view when the selected editor changes?

This should be quite a common problem, but I couldn't find anything helpful on the topic.
We are developing an application with Eclipse RCP. The application shows data in an editor of which usually multiple instances are open. In an additional view you can edit the editor-values. When the values are changed in the view they are updated in the editor and it's dirty flag is set.
So far it works fine. What we're missing is: When another editor instance gets the focus, our view should show the data of this editor.
I managed to do that for two views. The second view is sucessfully updated using a TableViewer as selection Provider and registering a SelectionListener in the other view. I tried the same thing for the editor using a Viewer I subclassed from ContentViewer, but it didn't work.
Can this approach be working?
Or do I need a different approach on the problem?
May be you can subclass your view from PageBookView and then provide special adapter for your editor. Outline View is implemented using this approach.
Thank you cerealk, that was exactly what I needed. :-)
Update the View when another Editor is selected
public class myView {
// Create an IPartListener2
IPartListener2 pl = new IPartListener2() {
// If the Editor I'm interested in was updated ...
public void partActivated(IWorkbenchPartReference ref) {
IWorkbenchPart part = ref.getPart(true);
if (part instanceof DetailEditor) {
// ... update the view
Contact contactFromSelectedEditor = ((DetailEditor) part).detailComposite.contact;
detailComposite.update(contactFromSelectedEditor);
}
}
...
}
// Add the IPartListener2 to the page
IWorkbenchPage page = this.getSite().getPage();
page.addPartListener(pl);
}
Why use an IPartListener2 instead of an IPartListener
The IPartListener2 replaces IPartListener with 3.5.
As explained in this this answer:
You should always use IPartListener2 as it can handle part-change events on parts that have not yet been
created because they are hidden in a stack behind another part.
This
listener will also tell you when a part is made visible or hidden or
when an editor's input is changed.

Resources