CoCreate User Forum  

Go Back   CoCreate User Forum > Applications > Data Management
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 05-13-2009, 08:24 AM
wilfried_loewe wilfried_loewe is offline
Registered User
 
Join Date: Jul 2004
Posts: 37
Protected attributes in BomEditor UI only ...

Hi,

is there a way to protect masterdata attributes in BomEditorUI only - not in AttributeEditor. If i set the tag of this attibute to: <Protect>true</Protect>, it's general protected. The users want to change LinkAttributes in BomEditUI only. I think, there is no way to do it by XML-Settings.

Is it posible to do it by Java (extend or replace a class) ??? Which class should be modified? Using MM version 16.00B/C

thank you ...
Reply With Quote
  #2  
Old 05-22-2009, 04:15 AM
wilfried_loewe wilfried_loewe is offline
Registered User
 
Join Date: Jul 2004
Posts: 37
Re: Protected attributes in BomEditor UI only ...

Hi,

I just solved my problem, when attribute is using the standard editor class WMAttEditorTextField. Small java extend of this class is requiered (Don't forget to set the editor class of attribute by tag <AttributeEditorClass>):

package com.kl_wl_custom.editor;

import com.osm.biz.*;
import com.osm.datamgmt.ui.WindowManager;
import com.osm.editor.WMAttEditor;
import com.osm.editor.WMAttEditorTextField;
import com.osm.exception.WMException;
/**
* Class to define a text editfield for an Attribute Editor -- write protected in BomManagerUI ...
*/
public class CustomAttEditorTextField extends WMAttEditorTextField {

private int mode;

// *** possible WMAttEditor modes:
// INIT_MODE = WMEditor.INIT_MODE = -1;
// EDIT_MODE = WMEditor.EDIT_MODE = 0;
// VIEW_MODE = WMEditor.VIEW_MODE = 1;
// QUERY_MODE = WMEditor.QUERY_MODE = 2;

/*----------------------- c o n s t r u c t o r -----------------------*/
public CustomAttEditorTextField(WMAttribute wmAttribute)
throws WMException {
super(wmAttribute);
}

public CustomAttEditorTextField(WMAttribute wmAttribute, boolean enabled)
throws WMException {
super(wmAttribute, enabled);
}

@Override
public void setEnabled(boolean enabled) {

if (enabled) {
java.awt.Component comp = WindowManager.getInstance().getActiveComponent();
com.osm.datamgmt.ui.EditUI editUI = com.osm.datamgmt.ui.WindowManager.getInstance().getActiveEditUI();

boolean isBomEditorActive = (editUI instanceof com.osm.datamgmt.ui.bom.BOMEditUI &&
comp instanceof com.osm.datamgmt.ui.bom.BomManagerUI);

// in BOMEditUI enabled always false - only in EDIT_MODE ...
if (isBomEditorActive && this.mode == WMAttEditor.EDIT_MODE) {
enabled = false;
}
}

super.setEnabled(enabled);
}

@Override
public void setMode(int mode) {
super.setMode(mode);
this.mode = mode;
}
}
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 12:32 AM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.