Skip to content
This repository has been archived by the owner on Mar 13, 2020. It is now read-only.

Commit

Permalink
added editor hook for hierarchical buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
pellepelster committed Jan 23, 2014
1 parent 1676db6 commit 066b4ad
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Expand Up @@ -11,8 +11,10 @@
*/
package de.pellepelster.myadmin.client.base.modules.dictionary.model;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import de.pellepelster.myadmin.client.base.db.vos.IBaseVO;
Expand All @@ -34,6 +36,18 @@ public static IDictionaryModel getDictionary(String dictionaryName)
}
}

public static List<IDictionaryModel> getDictionaries(List<String> dictionaryNames)
{
List<IDictionaryModel> dictionaryModels = new ArrayList<IDictionaryModel>();

for (String dictionaryName : dictionaryNames)
{
dictionaryModels.add(getDictionary(dictionaryName));
}

return dictionaryModels;
}

@Deprecated
public static IDictionaryModel getDictionaryModelForClass(Class<? extends IBaseVO> voClass)
{
Expand Down
Expand Up @@ -19,8 +19,12 @@

import com.google.gwt.user.client.rpc.AsyncCallback;

import de.pellepelster.myadmin.client.base.db.vos.IBaseVO;
import de.pellepelster.myadmin.client.base.db.vos.IHierarchicalVO;
import de.pellepelster.myadmin.client.base.module.IModule;
import de.pellepelster.myadmin.client.base.modules.dictionary.hooks.DictionaryHookRegistry;
import de.pellepelster.myadmin.client.base.modules.dictionary.model.DictionaryModelProvider;
import de.pellepelster.myadmin.client.base.modules.dictionary.model.IDictionaryModel;
import de.pellepelster.myadmin.client.base.modules.hierarchical.HierarchicalConfigurationVO;
import de.pellepelster.myadmin.client.base.util.CollectionUtils;
import de.pellepelster.myadmin.client.base.util.SimpleCallback;
Expand Down Expand Up @@ -88,6 +92,17 @@ public void onSuccess(HierarchicalConfigurationVO result)
}
}

for (String dictionaryId : HierarchicalTreeModule.this.hierarchicalConfiguration.getDictionaryIds())
{
List<String> childDictionaryIds = HierarchicalTreeModule.this.hierarchicalConfiguration.getChildDictionaryIds(dictionaryId);

if (!childDictionaryIds.isEmpty())
{
List<IDictionaryModel> childDictionaries = DictionaryModelProvider.getDictionaries(childDictionaryIds);
DictionaryHookRegistry.getInstance().addEditorHook(dictionaryId, new HierarchicalEditorHook<IBaseVO>(childDictionaries));
}
}

getModuleCallback().onSuccess(HierarchicalTreeModule.this);
}
});
Expand Down

0 comments on commit 066b4ad

Please sign in to comment.