I am currently working with gmf and I would like to change the colour of connections. I debug the code and I saw thatafter setting createConnectionFigure() method the foreground colour the refresh() method in the AbstractGraphicalEditPart class overrides this colour. Is there any special way that I can change the colour? Also I want to create a circle for source and target decoration of the link. I know that I have to extend the Polyline class but I don;t anything about the rest. Do you know any available example?
The preferred way to change the color of your figure is through the notation model(View).
While you create the edge view, you can set the line color for edge in the edge notation.
Connector edge = NotationFactory.eINSTANCE.createConnector();
ViewUtil.setStructuralFeatureValue(edge,NotationPackage.eINSTANCE.getLineStyle_LineColor(),new RGB(0,0,0));
If you have created your GMF editor plugin using GMF tools, there will be a class ViewProvider. There, they would have methods to create edge. You can change it there.
OR
Set the color in the PreferenceStore.
OR
worst case, you can override the refreshForegroundColor() in the ConnectionEditPart & set your own color. However the downside of this approach is, you cannot change the color through the UI.
As for decorations, in your connection figure, decoration can be set through setSourceDecoration & setTargetDecoration
eg: connection.setSourceDecoration(new org.eclipse.draw2d.PolylineDecoration());
Related
Trying to understand how to make component sets and use variance to make designing more simplified. I have a tile that has an icon on the right that I want to be able to change both what type of icon it is as well as its colour. Is there a way to create the two-component properties using variance? Do all the icons need to be grouped by color and do I need to adjust their naming conventions (still not to sure how that works as well)h
There is a more efficient way to do this, by taking advantage of Color Styles. With this method, you only have to create your icons once, and no need for variants. Color Style swapping will handle that.
Create your icon components, but using a boring black color. Avoid creating variants of the icons, if it's only the fill color that's changing.
Instead create a standard set of Color Styles for your icons.
Your designers then, could place an instance of a black icon from your library. Then use the Selection Panel to replace the black color with one of your defined color styles.
I have been trying to customize the Hint color in TextInputLayout and it works fine. But the problem is that I have to define color when there is an error, normal/Activated which is working and disabled state of the field.
So I tried creating three different styles with color normal, color activated and so on. But this doesn't seem to change the colour. I have indicated the Appcombat theme as the parent theme as well in my custom styles. I have tried applying these styles through java file as well.
Also let me know on how to define the size of the Hint text through style.
A bit late to the party, but here goes my solution to this:
Set the same style in errorTextAppearance and hintTextAppearance, both with the same color for the item android:textColor. When showing an error, set the error using a spannable with a ForegroundColorSpan with the color you wish to display in the error field, while the hint will remain in the color defined by the style set in errorTextAppearance.
I've made a simple shape editor. I can change colors (used to fill shapes) by click on buttons in a menu bar. The disadvangate of this solving is the fact that the numbers of colors are so restricted. I can't find a better solution for my program. Can somebody help me and give me an idea how can I improve it? I thought about color palette, but I have no idea how can I do this.
The image:
("Aktywny kolor" means active colors, and there is the list of colors below, which I can use)
You would need to use a color picker where the colors are distributed on many pixels and not on a very small set of color names. Since you are using applet, you might want to download an already made color picker compatible with your environment, or you might want to write your own, depending on whether the things you find meet your expectations.
I'm using d3 to draw a bar chart, where the bars are used to compare different groups (e.g. men/women). For the filling I take a color which is saved in the data file (json) and vary it using d3.rgb().darker()/.brighter().
.attr("fill", function(d){return d3.rgb(d.color).darker(1);})
It works in Firefox but in Internet Explorer 9 all the bars are shown as black (which is the first used color). I was wondering if this is just an issue with this browser in particular or if I am missing something to avoid this behavior.
One solution would be of course to assign the colors individually, but if possible I'd like to use the provided possibilities.
This happens because you're using attr("fill") instead of style("fill") to set a style property.
The style function includes some additional checking to turn a property value into an appropriate string if needed, so you wouldn't need to do the toString() yourself manually.
Changing your original line to:
.style("fill", function(d){return d3.rgb(d.color).darker(1);})
should work on all browsers including IE.
I want to show a ProgressBar. I am using this code:
EditorGUI.ProgressBar(Rect(3,45,100-6,20),20/700.0, "Armor");
I want to change the color of the ProgressBar from a light blue color to a red color. How can I do this?
As it stands, it doesn't appear that you can. However, I had a similar issue where I wanted a very customized bar with different colors to denote different things. I ended up using EditorGUI.DrawPreviewTexture. If you initialize the colors you want to use as a Texture2D, then pass them into that function with the properly placed rectangles, you can create portions of a bar that can change size and location to give the appearance of a standalone progress bar, especially if you keep the positions and size updated in the Update() function.