Skip to content

Commit

Permalink
WIP step 1
Browse files Browse the repository at this point in the history
Improve V11 ergonomy for dictionary management

Ameliorations:
- boite de dialogue "Dictionary management"
  - action "Insepect current dictionary" maintenant en menu popup, en plus du bouton

Impacts
- KWClassManagementDialogView::KWClassManagementDialogView
  - ajout de l'action d'inspection maquette en style "PopupMenu"
- UserInferface
  - UIAction: ajout de la pise en compte du style "PopupMenu"
- NormGUI
  - GUITable::buildPopupMenu: prise en compte dans le menu uniquement si styme "PopupMenu"
  • Loading branch information
marcboulle committed Nov 29, 2023
1 parent ea3466b commit a640fe2
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 15 deletions.
21 changes: 16 additions & 5 deletions src/Learning/KWUserInterface/KWClassManagementDialogView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ KWClassManagementDialogView::KWClassManagementDialogView()
{
KWClassSpecArrayView* classSpecArrayView;
KWClassSpecView* classSpecView;
UIAction* inspectDictionaryAction;

// Identifiant et libelle
SetIdentifier("KWClassManagementDialog");
Expand All @@ -29,13 +30,21 @@ KWClassManagementDialogView::KWClassManagementDialogView()
GetActionAt("ReloadFileButton")->SetStyle("Button");
GetActionAt("EditFileButton")->SetStyle("Button");

// Ajout d'une donnee liste
// Ajout d'une donnee liste non editable pour les dictionnaire
classSpecArrayView = new KWClassSpecArrayView;
AddListField("Classes", "Dictionaries", classSpecArrayView);
classSpecArrayView->SetEditable(false);
classSpecArrayView->GetActionAt("InspectItem")->SetVisible(true);
classSpecArrayView->GetActionAt("InspectItem")->SetLabel("Inspect current dictionary");
classSpecArrayView->GetActionAt("InspectItem")->SetStyle("SmallButton");

// Parametrage de son action d'edition en menu popup
inspectDictionaryAction = classSpecArrayView->GetActionAt("InspectItem");
inspectDictionaryAction->SetVisible(true);
inspectDictionaryAction->SetLabel("Inspect current dictionary");
inspectDictionaryAction->SetStyle("PopupMenu");

// Ajout d'un bouton egalement pour l'action d'edition
classSpecArrayView->AddAction("InspectItemButton", inspectDictionaryAction->GetLabel(),
inspectDictionaryAction->GetActionMethod());
classSpecArrayView->GetActionAt("InspectItemButton")->SetStyle("SmallButton");

// On indique que les champs Used et Type des attributs sont editables dans
// la fiche d'inspection d'un dictionnaire
Expand All @@ -55,13 +64,15 @@ KWClassManagementDialogView::KWClassManagementDialogView()
->SetHelpText(
"Allow to inspect and partly modify a dictionary chosen among the list of available dictionaries."
"\n The dictionary to inspect must be selected among the dictionaries in file.");
classSpecArrayView->GetActionAt("InspectItemButton")
->SetHelpText(classSpecArrayView->GetActionAt("InspectItem")->GetHelpText());

// Short cuts
GetActionAt("BuildClassDefButton")->SetShortCut('B');
GetActionAt("ReloadFileButton")->SetShortCut('L');
GetActionAt("EditFileButton")->SetShortCut('E');
classSpecArrayView->SetShortCut('D');
classSpecArrayView->GetActionAt("InspectItem")->SetShortCut('I');
classSpecArrayView->GetActionAt("InspectItemButton")->SetShortCut('I');
}

KWClassManagementDialogView::~KWClassManagementDialogView() {}
Expand Down
2 changes: 1 addition & 1 deletion src/Learning/MODL/MODL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int argc, char** argv)
// Choix du repertoire de lancement pour le debugage sous Windows (a commenter apres fin du debug)
// SetWindowsDebugDir("Standard", "IrisLight");
// SetWindowsDebugDir("Standard", "Iris2D");
SetWindowsDebugDir("Rules", "DateTimeRules");
SetWindowsDebugDir("z_Work", "IrisLight");

// Parametrage des logs memoires depuis les variables d'environnement, pris en compte dans KWLearningProject
// KhiopsMemStatsLogFileName, KhiopsMemStatsLogFrequency, KhiopsMemStatsLogToCollect
Expand Down
4 changes: 2 additions & 2 deletions src/Norm/NormGUI/src/normGUI/engine/GUITable.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ public void valueChanged(ListSelectionEvent e)
*/
public void buildPopupMenu()
{
// Si la liste contient des actions, on construit le popmenu
// Si la liste contient des actions de type popup, on construit le popmenu
if (guiList.vectorOfGUIActions.size() > 0) {
popMenu = new JPopupMenu();
// Pour chaque action
for (int i = 0; i < guiList.vectorOfGUIActions.size(); i++) {
GUIAction action = (GUIAction)guiList.vectorOfGUIActions.get(i);
// Si l'action n'est pas un exit ni un refresh (actions standards des unites)
if (action.getVisible() && action.getStyle().equals("") &&
if (action.getVisible() && action.getStyle().equals("PopupMenu") &&
!action.getIdentifier().equals(GUIUnit.Exit) &&
!action.getIdentifier().equals(GUIUnit.Refresh)) {
JMenuItem menuItem = new JMenuItem(action.getLabel());
Expand Down
6 changes: 3 additions & 3 deletions src/Norm/NormGUI/src/normGUI/engine/GUIUnit.java
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ public boolean hasHelpText()
GUIAction guiAction = (GUIAction)vectorOfGUIActions.get(i);
if (guiAction.getVisible() && !guiAction.getIdentifier().equals(Exit) &&
!guiAction.getIdentifier().equals(Refresh)) {
if (guiAction.getHelpText().length() > 0)
if (!guiAction.getHelpText().equals(""))
hasActionHelpText = true;
}
}
Expand All @@ -1077,15 +1077,15 @@ public boolean hasHelpText()
hasDataUnitHelpText = ((GUIUnit)guiData).hasHelpText();
// S'il s'agit d'un element
else {
if (guiData.getHelpText().length() > 0)
if (!guiData.getHelpText().equals(""))
hasDataElementHelpText = true;
}
}
}

// On ne considere que l'aide sur les unites, l'aide sur les elements terminaux
// etant fournie par les info-bulles
return (getHelpText().length() > 0 || hasDataUnitHelpText);
return ((!getHelpText().equals("")) || hasDataUnitHelpText);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Norm/base/UIElements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ boolean UIAction::Check() const
ALString sTmp;

// Verification du style
if (GetStyle() != "" and GetStyle() != "Button" and GetStyle() != "SmallButton")
if (GetStyle() != "" and GetStyle() != "PopupMenu" and GetStyle() != "Button" and GetStyle() != "SmallButton")
{
bOk = false;
AddError("Le style " + GetStyle() + " est inconnu");
Expand Down
8 changes: 5 additions & 3 deletions src/Norm/base/UserInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ class UIList : public UIUnit
void SetLastColumnExtraWidth(int nValue);
int GetLastColumnExtraWidth() const;

// Redefinition du SetEditable (pour la propagation aux composant et les
// Redefinition du SetEditable (pour la propagation aux composants et les
// actions d'edition de la liste)
void SetEditable(boolean bValue) override;

Expand Down Expand Up @@ -1734,8 +1734,10 @@ class UIAction : public UIObject
////////////////////////////////////////////////////////////////////////
// Style: par defaut vide
// Valeurs possibles:
// vide: action maquettee dans les menus, et en plus dans les popup
// pour les actions de liste
// vide: action maquettee dans les menus, y compris dans les UIList
// pour les actions d'edition predefinies
// PopupMenu: action maquettee dans les menus popup dans la cas d'une
// action de UIList
// Button: action maquettee sous forme de boutton
// SmallButton: action maquettee sous forme de boutton de plus petite taille
// et insere a gauche dans la colonne des libelles
Expand Down

0 comments on commit a640fe2

Please sign in to comment.