How to add/edit Label name in Panel of GEF - eclipse-gef

I am using Panel as a Figure in GEF eclipse. Now on double click I want to add a Label as other normal example shows .
How to achieve that.

On the EditPart that manages the figure you should install a DIRECT_EDIT_ROLE policy (implemented by DirectEditPolicy class). This will cause your EditPart to be called when double clicks occur on the figure. The framework will call method performRequest with a RequestConstants.REQ_OPEN or RequestConstants.REQ_DIRECT_EDIT request. Upon receiving the request you can add whatever you want to the figure and refresh visuals.
If you want to edit text inside a Label, you can see how I implemented this here.
Good luck.

Related

Using bootstrap calendar inside slickgrid then Calendar is stuck issue

I am using bootstrap calendar inside slickgrid. When calendar popup is opened and use Alt+tab or scope out of slickgrid then calendar gets stuck. I have to reload application to get rid of calendar popup. I want to close calendar pop up as soon as user scopes out of slickgrid. Please suggest way to do it.
Not sure if it's your problem but you can't use just a z-index in SlickGrid that won't work and won't do anything, you need to use position: absolute on your Editor (each editor has a args.position passed to their constructor) that you can use to reposition your editor next to the cell that you clicked, however make sure that you also add a position() method that will be called if it exist and of course you need to add proper code to reposition the DOM element inside that method. Also when you click on a different cell then the previous Editor will call the destroy method, so make sure you remove the Editor properly by adding necessary code in your destroy() method.
All of that position usage can be seen in 1 of the built-in Editor which is the LongText defined in the slick.editors.js on this line
The absolute style is applied here
and the position(cellPosition) method is defined here
If your problem is really that your Editor doesn't get removed from the DOM, then it's because you didn't code the destroy() properly and here is the LongText destroy() method for reference. Also you might want to add an onBlur event that will call your destroy() method after a blur or any other event that you choose.
and here's a print screen of the LongText Editor that is repositioned over the cell you clicked and you can test it yourself in this Example - Editing

Angular Material md-select load options in async way

I need to load select's options asynchronously (
through a service), using the Angular Material md-select component.
Actually, I use a click event to load data. It works but I need to click the select twice to show the options. That it's a problem.
The expected behavior is shown at this link (AngularJs Material)
The actual behavior is shown at this link.
Is Async options' loading supported by md-select?
The reason you need to click twice is because when you first click, there are no options in the select control and so it doesn't try and open the panel. Then your async method loads the options into the DOM and on the next click it will open.
In order to deal with this, you must always include at least one <mat-option> in your <mat-select>. You can add a disabled <mat-option> with a <mat-spinner> showing that the data is loading for example.
Here the most simple example of that. This is not the best approach... see below.
However, this still uses the click event which isn't the best approach. If you put the click event on the <mat-select> there are spots where you can click on the control but your click event wont trigger even though the dropdown panel still opens (places like the floating label area). You could put the click event on the <mat-form-field> but then there will be places where you can click and trigger the click event but the dropdown panel wont open (places like the hint/error text area). In both cases you lose keyboard support.
I would suggest using the <mat-select> openChanged event instead of a click event. This has its own quirks too but they are manageable.
Here is an example using the openChanged event. I also made the component more robust overall.
I also made a version that uses the placeholder element to show the spinner instead of using a disabled mat-option. This required View Encapsulation to be turned off.
Note: In my example, the service can return different data depending on the circumstances. To simulate this my fake service keeps track of how many requests you send it and changes the options returned accordingly. So I have to set the option list back to empty and clear the formControl's value every time the list is opened. I save the selected value before clearing the formControl so that if the service returns a list with the same item I can automatically reselect the value. If you only need to load the options once, then you would want to modify the code a bit to only load the options the first time the user opens the select.

Sitecore page editor dropdown

I would kindly ask for your help :) From couple of days I am trying to achieve "linked" custom field in content editor and dropdown in page editor.
Basically I want to have dropdown in page editor and content editor which are responsible for a same thing.
In my c# code i have enums which represent directions. I created custom field which accepts assembly and class with overridden onload method and successfully populate dropdown values in the content editor. So far so good but i have no idea how to create dropdown which will represent the same functionality inside page editor.
So please give me any ideas...
Judging from your reply to my comment you need to think of the following: How is my field value being rendered onto a page?
If you are always using 1 control to do this then you just need to ensure that this control has 2 different rendering modes depending on the Context.PageMode
But as I understand it you want this dropdown to also appear when someone renders your custom field using a <sc:FieldRenderer>. In this case you'll need to look into the RenderField pipeline of Sitecore. There you find a processor called RenderWebEditing. Possibly through some manipulation here you can get your dropdown appear as you wish.

Designing and printing a receipt format in flex

I want to design a Receipt in flex.
Which control shall I use to display a table if I want to display some table cells without border? I also want to merge cells in the table just as we used to do in Excel.
Can anyone please give me the code to print the Receipt upon the button click?
I would probable use a List control with a customItemRenderer or a textArea with some fancy text formatting. As for giving you the code, I would be happy to provide input to code you have done or point you in the right direction but cant do your work for you. Best of luck.
Please prepare your receipt layout in flex and just check your layout is proper or not. if it proper then put one button and write down the printjob code on click event of the button. be sure at the time of click event please hide the button till printing is done (means upto send method called)
please refer PrintJob Class of ActionScript for your application to get receipt printing through your flex application.

pass button click event through several usercontrols to a form and let another usercontrol know the button clicked

I know it sounds complex but thats true.
I have a winform(clientFile) which in a project. It uses an usercontrol in another project. This usercontorl is FinancialManager.It is initialized in constructor.
In FinancialManager, there is another child usercontrol(FinancialService) which is initialized in constructor too.
In FinancialService, it has a button and in the button click event, it initialized the last usercontrol(FinancialItem).
I need to use WINFORM and C# to let my usercontrol(timeControl) which is in the ClientFile(initialized in page_load) know the button in FinancialItem is clicked.
is there any good way to do it? If you can give a sample code, that will be perfect.
Thank you.
by the way, those usercontrols are in one project. except my usercontrol(timeControl).
Since you can control the code in your own usercontrols, it seems to me like you want to add a custom event in one of your usercontrols. Then diferent code can subscribe to this event and will know if the event was triggered.
...but it was a bit hard to understand exactly what you wanted...
Look up a basic event tutorial, and you're probably good to go.

Resources