Enterprise Architect: Hide only "top" labels of connectors programmatically - enterprise-architect

I want to hide the "top" part of all connector labels of a diagram. For this, I tried to set up a script, but it currently hides ALL labels (also the "bottom" labels which I want to preserve):
// Get a reference to the current diagram
var currentDiagram as EA.Diagram;
currentDiagram = Repository.GetCurrentDiagram();
if (currentDiagram != null)
{
for (var i = 0; i < currentDiagram.DiagramLinks.Count; i++)
{
var currentDiagramLink as EA.DiagramLink;
currentDiagramLink = currentDiagram.DiagramLinks.GetAt(i);
currentDiagramLink.Geometry = currentDiagramLink.Geometry
.replace(/HDN=0/g, "HDN=1")
.replace(/LLT=;/, "LLT=HDN=1;")
.replace(/LRT=;/, "LRT=HDN=1;");
if (!currentDiagramLink.Update())
{
Session.Output(currentDiagramLink.GetLastError());
}
}
}
When I hide only the top labels manually (context menu of a connector/Visibility/Set Label Visibility), the Geometry property of the DiagramLinks remains unchanged, so I guess the detailed label visibility information must be contained somewhere else in the model.
Does anyone know how to change my script?
Thanks in advance!
EDIT:
The dialog for editing the detailed label visibility looks as follows:
My goal is unchecking the "top label" checkboxes programmatically.

In the Geometry attribute you will find a partial string like
LLT=CX=36:CY=13:OX=0:OY=0:HDN=0:BLD=0:ITA=0:UND=0:CLR=-1:ALN=1:DIR=0:ROT=0;
So in between LLT and the next semi-colon you need to locate the HDN=0 and replace that with HDN=1. A simple global change like above wont work. You need a wild card like in the regex LLT=([^;]+); to work correctly.

Related

Typo3 Content Elements missing in wizard

I have some content elements in a site package which I want to show up in the content element wizard as explained here:
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentElements/ContentElementsWizard.html
Basically I have done the same as shown in the section "Create a new tab"
Configuration\TsConfig\Page\ContentElement\All.tsconfig is looking like this:
mod.wizards.newContentElement.wizardItems.mci.header = MCI
mod.wizards.newContentElement.wizardItems.mci {
elements {
mci_home_banner {
iconIdentifier = home-banner
title = Home-Banner
description = Banner der Startseite
tt_content_defValues.CType = mci_home_banner
}
mci_home_banner_element {
iconIdentifier = home-banner-element
title = Home Banner Element
description = Element im Starseitenbanner
tt_content_defValues.CType = mci_home_banner_element
}
}
show := addToList(mci_home_banner, mci_home_banner_element)
}
I reduced the code to just 2 elements. They are not shown at all, but are available over the dropdown, so I can switch to one of them after choosing another element.
This didn't work when created in 9.5 and still does not work after switching to version 11.5.10
What am I missing?
#user414873 Did you try to add your custom elements to the "common" tab instead of your new one "mci"?
And did you try to use an existing icon identifier (e.g. "content-image" or an other one - see https://typo3.github.io/TYPO3.Icons/)? Just to make sure that there is no problem with your custom icons that prevents the elements from being displayed.
Does this minimal example work for you:
mod.wizards.newContentElement.wizardItems.common {
elements {
mci_home_banner {
iconIdentifier = content-image
title = Home-Banner
description = Banner der Startseite
tt_content_defValues.CType = mci_home_banner
}
}
show := addToList(mci_home_banner)
}
And I would doubt this:
I guess otherwise the content elements wouldn't be available at all.
I suggest you check it's correctly included by using the "Info" module in your TYPO3 main menu. Then select the page where the content element should be included and switch the dropdown on top of the content area to "View TSconfig fields content". Now you can search for "wizards" and check if your element is included.

Gtk (mm) limit width of combobox

Because I use Comboboxes that may contain text entries of very long size,
which leads to the combobox increasing its width far beyond reasonable size,
I am trying to give a maximum width to the combobox.
If I am doing this like this:
class MyCombo : public Gtk::ComboBox {
private:
CellRendererText render;
public:
MyCombo() {
render.property_width_chars() = 10;
render.property_ellipsize() = Pango::ELLIPSIZE_END;
pack_start(render, true);
}
};
The result will be an empty cell of the desired width, which seems logical since I did not specify which column to show. But how can I do this with that attempt? Using pack_start will just bypass the renderer...
Another approach is this one:
class MyCombo : public Gtk::ComboBox {
private:
CellRendererText render;
public:
MyCombo() {
pack_start(render, true);
set_cell_data_func(render, sigc::mem_fun(*this, &MyCombo::render_iter));
}
void render_iter(const TreeModel::const_iterator& iter) {
Glib::ustring data = get_string_from_iter(iter);
int desired_width_chars = 10; //for example
render.property_text() = ellipsize_string(data, desired_width_chars);
}
};
Using that approach, it works, but the text in the popup (what opens up when u click the combobox) is also shortened which is not what I want (obviously the user should be able to read the whole string and I dont care about the popup widht.)
Can you please help me with this? I would be happy for any advice/alternative solutions.
Regards tagelicht
NOTE: set_wrap_width is a function that wraps the total number of entries in the combo box over a number of columns specified; it does not answer the question.
Using set_wrap_width(1) | Using set_wrap_width(5)
Following Noup's answer as a guide I managed to get the below code; which directly answers the question and its requirements (C++/Gtkmm).
// Get the first cell renderer of the ComboBox.
auto v_cellRenderer = (Gtk::CellRendererText*)v_comboBox.get_first_cell();
// Probably obsolete; Sets character width to 1.
v_cellRenderer->property_width_chars() = 1;
// Sets the ellipses ("...") to be at the end, where text overflows.
// See Pango::ELLIPSIZE enum for other values.
v_cellRenderer->property_ellipsize() = Pango::ELLIPSIZE_END;
// Sets the size of the box, change this to suit your needs.
// -1 sets it to automatic scaling: (width, height).
v_cellRenderer->set_fixed_size(200, -1);
Result (image):
Result of code
BE AWARE: Depending on where you perform the above code; either all the cells will be the same size, or just the box itself (intended).
From experimenting, I've found:
In the parent object constructor: All cell sizes are the same.
In a separate function: Only the first cell (the box) is affected.
I'd recommend you put the code in a function that's connected to the comboBox's changed signal, such as:
v_comboBox.signal_changed().connect(sigc::mem_fun(*this, &YourClass::comboBox_changedFunction));
This may be what you are looking for:
cell_renderer_text.set_wrap_width(10)
This is for Python, but you get the idea :-)
Unfortunately, the documentation is scarce. I found this by poking around in Anjuta/Glade.
Edit:
the docs are here. They are not overly helpful, but they do exist.
As an alternative, the following works for me without having to set wrap_width nor to subclass ComboBox (in Gtk#):
ComboBoxText cb = new ComboBoxText();
cb.Hexpand = true; //If there's available space, we use it
CellRendererText renderer = (cb.Cells[0] as CellRendererText); //Get the ComboBoxText only renderer
renderer.WidthChars = 20; //Always show at least 20 chars
renderer.Ellipsize = Pango.EllipsizeMode.End;
Note: I'm using Expand to use space if it's available. If you just want to keep the combo box on a fixed width, just remove that bit.

Press, hide button in ChartContainerContent in UI5 fiori

Hi all SAP UI5 and FIORI positive,
I have ChartContainer with button for graph and button for table. It is defined in xml file as:
<suite:ChartContainerContent id="idButtonChart"
icon = "sap-icon://bar-chart"
title = "Chart"
>
<suite:ChartContainerContent id="idButtonTable"
icon = "sap-icon://table-view"
title = "{i18n>table}">
<suite:content>
Let's say I want to hide some of these buttons which are placed inside ChartContainer. I have tried (in controller.js part):
this.getView().byId("idButtonChart").setVisible(false);
or
this.getView().byId("idButtonChart").setVisible(false);
But this code, hided graph but not button. Please, do you have any idea how to hide button? Or to trigger click event on button idButtonTable?
Thanks for any advices.
Have you found any good solution for this issue? I've been checking the SDK and I can't find a way to get those buttons in an straight way.
Anyway, you could do it using the following code -
var chartContainerContent = this.getView().byId('your chart id');
var chartContainer = chartContainerContent.getParent();
var aToolbarButtons = chartContainer._oToolBar.getContent();
var segmentedButton;
for(var i=0; i<aToolbarButtons.length; i++){
var button = aToolbarButtons[i];
if(button.getMetadata()._sClassName === "sap.m.SegmentedButton"){
segmentedButton = button;
break;
}
}
//segmentedButton.getButtons()
Once you get the buttons you can setVisible(false) to the one you want.
Of course this is not the best, but the chartContainer doesn't provide any public function to get the buttons of the chart.
I try to understand the issue. You define 2 charts in your example.
The buttons are usually used to switch the display to the corresponding chart.
How are you going to switch between the 2 charts if you hide the corresponding button?
A little late but I guess an .updateChartContainer() after the .setVisible should do the trick:
this.getView().byId("idButtonChart").setVisible(false);
this.getView().byId("<NAME OF THE CONTENT CONTAINER>").updateChartContainer();

Why doesn't marker.dragging.disable() work?

The following code receives an error on the lines for enabling and disabling the marker dragging ("Unable to get property 'disable' of undefined or null reference"). The markers show up on the map just fine and are draggable as the creation line indicates. Placing an alert in place of the enable line produces a proper object so I believe the marker is defined. Is there something I need to do to enable the IHandler interface? Or am I missing something else?
var marker = L.marker(L.latLng(lat,lon), {icon:myIcon, draggable:'true'})
.bindLabel(name, {noHide: true,direction: 'right'});
marker._myId = name;
if (mode === 0) {
marker.dragging.enable();
} else {
marker.dragging.disable();
}
I had a similar problem today (perhaps the same one) it was due to a bug in leaflet (see leaflet issue #2578) where changing the icon of a marker invalidates any drag handling set on that marker. This makes any calls to marker.dragging.disable() fail.
The fix hasn't made it into leaflets master at time of writing. A workaround is to change the icon after updating the draggable status if possible.
marker.dragging.disable();
marker.setIcon(marker_icon);
Use the following code to make an object draggable. Set elementToDrag to the object you wish to make draggable, which is in your case: "marker"
var draggable = new L.Draggable(elementToDrag);
draggable.enable();
To disable dragging, use the following code:
draggable.disable()
A class for making DOM elements draggable (including touch support).
Used internally for map and marker dragging. Only works for elements
that were positioned with DomUtil#setPosition
leaflet: Draggable
If you wish to only disable the drag option of a marker, then you can use the following code (where "marker" is the name of your marker object):
marker.dragging.disable();
marker.dragging.enable();
I haven't found an answer but my workaround was this:
var temp;
if (mode === 0) {
temp = true;
} else {
temp = false;
}
var marker = L.marker(L.latLng(lat,lon), {icon:myIcon, draggable:temp})
.bindLabel(name, {noHide: true,direction: 'right'});
marker._myId = name;
Fortunately I change my icon when it is draggable.

Unable to uncheck a checkbox within a combo box

I have a combo box which contains two List Items. Each list item consists of a checkbox and a text message.
Now, I am using a function which looks something like this to uncheck all the checkbox's within the combobox.
public ApplicationReports UnSelectAllCheckBox()
{
int i = 0;
ComboBox someVariable= Application.Library.GetFromWindow(Application.Configuration.LoginWindow.Title).OfType<ComboBox>("corresponding Automation Id");
foreach (ListItem casino in someVariable.Items)
{
someVariable.Item(i).UnCheck();
i++;
}
// someVariable.Item(0).UnCheck();
return this;
}
I am able to uncheck the second checkbox using this approach but not the first one. Unable to identify
what is the problem when it is working fine for the second list item. I am using the recently released version of
white framework. "someVariable" is not a problem. I checked its retrieving the correct combo box while
debugging.
Try this instead:
foreach (ListItem casino in someVariable.Items)
{
casino.UnCheck();
}
No need to use i and make your own loop iterator.