下面列出了javafx.scene.Node#setManaged ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Update the content pane using the selected item in the list.
*/
private void updateContent() {
HBox selected_item = listView.getSelectionModel().getSelectedItem();
Text selected_text = (Text) selected_item.getChildren().get(1);
for (Node node : configContentContainer.getChildren()) {
boolean matches_clicked = node.getUserData().toString().equals(selected_text.getText());
node.setVisible(matches_clicked);
node.setManaged(matches_clicked);
}
}
private void manageNode(final Node NODE, final boolean MANAGED) {
if (MANAGED) {
NODE.setManaged(true);
NODE.setVisible(true);
} else {
NODE.setVisible(false);
NODE.setManaged(false);
}
}
private void manageNode(final Node NODE, final boolean MANAGED) {
if (MANAGED) {
NODE.setManaged(true);
NODE.setVisible(true);
} else {
NODE.setVisible(false);
NODE.setManaged(false);
}
}
private void createOverlayNodes() {
paragraphTextNode = getParent().lookup(".paragraph-text");
for (OverlayFactory overlayFactory : overlayFactories) {
overlayFactory.init(textArea, paragraphTextNode, gutter);
List<Node> nodes = overlayFactory.createOverlayNodes(paragraphIndex);
overlayNodesMap.put(overlayFactory, nodes);
for (Node node : nodes)
node.setManaged(false);
getChildren().addAll(nodes);
}
}
private static void updateManagedProperty(Node n, DeviceType type) {
// first time we've set this invisible => store the preset
if (!n.getProperties().containsKey(PROP_MANAGED_STATE)) {
n.getProperties().put(PROP_MANAGED_STATE, n.isManaged());
}
// don't track changes through this
n.managedProperty().removeListener(MANAGED_LISTENER);
// If it's visible we use the stored value for "managed" property
n.setManaged(n.isVisible() ? (Boolean) n.getProperties().get(PROP_MANAGED_STATE) : false);
// need to track changes through API
n.managedProperty().addListener(MANAGED_LISTENER);
}
public static final void enableNode(final Node node, final boolean enable) {
node.setVisible(enable);
node.setManaged(enable);
}
public static final void enableNode(final Node NODE, final boolean ENABLE) {
NODE.setManaged(ENABLE);
NODE.setVisible(ENABLE);
}
public static final void enableNode(final Node NODE, final boolean ENABLE) {
NODE.setVisible(ENABLE);
NODE.setManaged(ENABLE);
}
public static final void enableNode(final Node NODE, final boolean ENABLE) {
NODE.setManaged(ENABLE);
NODE.setVisible(ENABLE);
}
public static final void enableNode(final Node NODE, final boolean ENABLE) {
NODE.setManaged(ENABLE);
NODE.setVisible(ENABLE);
}
private void applySecurity(Scene s, UserSecurity security, Node n) {
if( n == null ) return;
if( n.getProperties().containsKey(NodePropertiesKeyType.commandType) ) {
//
// This is a Node that should have security applied
//
CommandType command = (CommandType) n.getProperties().get(NodePropertiesKeyType.commandType );
AccessType access = security.getAccess(command);
if( log.isDebugEnabled() ) {
log.debug("[APPLY] command={}, access={}", command, access);
}
switch( security.getAccess(command) ) {
case SHOW:
n.setVisible(true);
n.setDisable(false);
n.setManaged(true);
break;
case HIDE:
n.setVisible(false);
n.setDisable(true);
n.setManaged(false);
break;
case DISABLE:
n.setVisible(true);
n.setDisable(true);
n.setManaged(true);
break;
}
}
//
// Menus and MenuItems are not Nodes
//
if( n instanceof MenuBar ) {
MenuBar mb = (MenuBar)n;
for( Menu toplevel : mb.getMenus() ) {
applySecurity( s, security, toplevel );
}
}
if( n instanceof Parent) {
Parent p = (Parent)n;
for( Node childNode : p.getChildrenUnmodifiable() ) {
applySecurity( s, security, childNode );
}
p.layout();
}
}
private void makeHidden(Node node) {
node.setVisible(false);
node.setManaged(false);
}
private void makeVisible(Node node) {
node.setVisible(true);
node.setManaged(true);
}